现在我正在做一个修改页面,其中有一个难度系数的选项,其中1,2,3分别代表易,中,难,当我运行页面时,我希望我的RadioButtonList的选项选中项是根据数据库的数据来定,如 如果数据库中的数据为2,则单选按钮就选着"中"中,代码如下
<asp:RadioButtonList id="ndxs" style="Z-INDEX: 129; LEFT: 344px; POSITION: absolute; TOP: 472px" runat="server"Width="176px" Height="24px" RepeatDirection="Horizontal">
<asp:ListItem Value="1">容易</asp:ListItem>
<asp:ListItem Value="2">中等</asp:ListItem>
<asp:ListItem Value="3">困难</asp:ListItem>
</asp:RadioButtonList>
我用的以下代码,却有错
if(ndxs.SelectedItem.Text==objr["sdaan"].ToString())
    ndxs.SelectedItem.Selected=true;
各位大哥谢谢了