大家好後,我看不到我的動態生成單選按鈕列表或CheckBoxList的項目回傳
很顯然wehn我改變任何控件,然後回發的SaveViewState方法保存更改並回傳後應用它們agian,看到如下因素代碼通知,把服務器端代碼在scrispt在我的代碼liske這<%%>
switch (myQuestion.QuestionType)
{
case 0:
{
rdlistAnswers.Items.Clear();
foreach (sting item in myCollection)
{
ListItem i = new ListItem();
i.Value = item;
i.Text = item;
rdlistAnswers.Items.Add(i);
}
**//the folowing line of code is not a comment, it's a tag for asp control
//but I commeted it due to editing requirements**
//<asp:RadioButtonList ID="rdlistAnswers" runat="server"</asp:RadioButtonList>
break;
}
case 1:
{
cblistAnswers.Items.Clear();
foreach (sting item in myCollection)
{
ListItem i = new ListItem();
i.Value = item;
i.Text = item;
cblistAnswers.Items.Add(i);
}
<asp:CheckBoxList ID="cblistAnswers" runat="server" </asp:CheckBoxList>
}
}
現在我可以看到我的名單fileed但是當我選擇一個項目,按下一個按鈕SelectedItem屬性該清單仍爲空,是什麼原因?
我不確定我是否理解你的問題?你有什麼問題? – brendan 2009-01-05 16:12:43