MutuallyExclusiveCheckBox控件实现复选框互斥功能
属性列表:
TargetControlID:被控制控件的ID
Key: 区分互斥复选框的键值(两个互斥复选框的要一样)
实例解析一、简单实现
1<form id="form1" runat="server">
2 <div>
3 <asp:ScriptManager ID="ScriptManager1" runat="server">
4 </asp:ScriptManager>
5
6 </div>
7 <asp:CheckBox ID="net" runat="server" Text="net" />
8 <asp:CheckBox ID="jsp" runat="server" Text="jsp" /><br />
9 <asp:CheckBox ID="aspnet" runat="server" Text="aspnet"/>
10 <asp:CheckBox ID="java" runat="server" Text="java" />
11 <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender1" runat="server"
12 Key="one" TargetControlID="net">
13 </cc1:MutuallyExclusiveCheckBoxExtender>
14 <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender2" runat="server"
15 Key="two" TargetControlID="jsp">
16 </cc1:MutuallyExclusiveCheckBoxExtender>
17 <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender3" runat="server"
18 TargetControlID="aspnet" Key="two">
19 </cc1:MutuallyExclusiveCheckBoxExtender>
20 <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender4" runat="server" TargetControlID="java" Key="one">
21 </cc1:MutuallyExclusiveCheckBoxExtender>
22 </form>
2 <div>
3 <asp:ScriptManager ID="ScriptManager1" runat="server">
4 </asp:ScriptManager>
5
6 </div>
7 <asp:CheckBox ID="net" runat="server" Text="net" />
8 <asp:CheckBox ID="jsp" runat="server" Text="jsp" /><br />
9 <asp:CheckBox ID="aspnet" runat="server" Text="aspnet"/>
10 <asp:CheckBox ID="java" runat="server" Text="java" />
11 <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender1" runat="server"
12 Key="one" TargetControlID="net">
13 </cc1:MutuallyExclusiveCheckBoxExtender>
14 <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender2" runat="server"
15 Key="two" TargetControlID="jsp">
16 </cc1:MutuallyExclusiveCheckBoxExtender>
17 <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender3" runat="server"
18 TargetControlID="aspnet" Key="two">
19 </cc1:MutuallyExclusiveCheckBoxExtender>
20 <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender4" runat="server" TargetControlID="java" Key="one">
21 </cc1:MutuallyExclusiveCheckBoxExtender>
22 </form>