RadioButtonList可以根据各项的文本设定某项为选定项么?

解决方案 »

  1.   

      <asp:RadioButtonList ID="RadioButtonList1" runat="server">
        <asp:ListItem Text="选项1" Value="1"></asp:ListItem>
           <asp:ListItem Text="选项2" Value="2"></asp:ListItem>
        </asp:RadioButtonList>
     foreach (ListItem item in RadioButtonList1.Items)
            {
                if (item.Text == "选项1")
                {
                    item.Selected = true;
                }
            }