altas(ajax)控件(十七):互斥复选框控件MutuallyExclusiveCheckBox
实例:
任何时候只有一个复选框被选中
<b>选中</b><br />
<asp:Checkbox runat="server" ID="c1" Text="选择" />
<ajaxToolkit:MutuallyExclusiveCheckboxExtender runat="server" ID="m1" TargetControlID="c1" Key="CB" />
<b>不选中</b><br />
<asp:Checkbox runat="server" id="c2" Text="反选" />
<ajaxToolkit:MutuallyExclusiveCheckboxExtender ID="m2" runat="server" TargetControlID="c2" Key="CB" />
属性 |
解释 |
TargetControlID |
目标控件 |
Key |
同一个key为同一组关联复选框 |
三个复选框也是一样,只能有一个被选中。
效果如下
1
<asp:Checkbox runat="server" ID="c1" Text="选1" />
<ajaxToolkit:MutuallyExclusiveCheckboxExtender runat="server" ID="m1"
TargetControlID="c1"
Key="CB" />
2
<asp:Checkbox runat="server" id="c2" Text="选2" />
<ajaxToolkit:MutuallyExclusiveCheckboxExtender ID="m2" runat="server" TargetControlID="c2"
Key="CB" />
3
<asp:Checkbox runat="server" id="c3" Text="选3" />
<ajaxToolkit:MutuallyExclusiveCheckboxExtender ID="m3" runat="server" TargetControlID="c3"
Key="CB" />
http://asp.net/AJAX/Control-Toolkit/Live/MutuallyExclusiveCheckBox/MutuallyExclusiveCheckBox.aspx