<asp:Panel ID="Panel1" runat="server" GroupingText="未脱轨" Width="100%" HorizontalAlign="Left">
<asp:RadioButtonList ID="RadioButtonList1" runat="server"
DataTextField="title" DataValueField="Id"
onselectedindexchanged="RadioButtonList1_SelectedIndexChanged" AutoPostBack="true">
</asp:RadioButtonList>
</asp:Panel>
<asp:Panel ID="Panel2" runat="server" GroupingText="未脱轨" Width="100%" HorizontalAlign="Left">
<asp:RadioButtonList ID="RadioButtonList2" runat="server" DataTextField="title"
DataValueField="Id" ValidationGroup="a"
onselectedindexchanged="RadioButtonList2_SelectedIndexChanged" AutoPostBack="true">
</asp:RadioButtonList>
</asp:Panel>
后台:
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
RadioButtonList2.ClearSelection();
}
protected void RadioButtonList2_SelectedIndexChanged(object sender, EventArgs e)
{
RadioButtonList1.ClearSelection();
}
设置autopostback为true,当有选中触发的时候,就回传清空其它组里面的选中项
- 本文标题: 多个RadioButtonList组 动态读取只能选择唯一一个的解决方案
- 文章分类:【.NET/Web】
- 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.