功能:
可以应用到页面中的CheckBox上,通过为一组CheckBox指定同样的Key,让它们拥有类似单选按钮组(Radio Button Group)的行为,即用户只能选择组中的某一项。与单选按钮组不同的是,这个由CheckBox组成的单选按钮允许取消选择,即不选择组中的任意一项,而传统的单选按钮组则无法实现这个功能。
属性:
Key:隶属于同一群组的复选框,必须具有独一的键值。
TargetControlID:目标控件ID值。
实例代码:
 <html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head runat="server">
<head runat="server">
 <title>Untitled Page</title>
    <title>Untitled Page</title>
 </head>
</head>
 <body>
<body>
 <form id="form1" runat="server">
    <form id="form1" runat="server">
 <asp:ScriptManager ID="sm" runat="server" />
     <asp:ScriptManager ID="sm" runat="server" />
 <table>
         <table>
 <tr>
                <tr>
 <td colspan="2" >
                  <td colspan="2" >
 外出旅游,您会携带‧‧‧
                    外出旅游,您会携带‧‧‧
 </td>
                  </td>
 </tr>
                </tr>
 <tr>
                <tr>
 <td style="width: 165px" >
                  <td style="width: 165px" >
 会携带
                    会携带
 </td>
                  </td>
 <td style="width: 165px" >
                  <td style="width: 165px" >
 不会携带
                    不会携带
 </td>
                  </td>
 </tr>
                </tr>
 <tr>
                <tr>
 <td>
                  <td>
 <asp:CheckBox ID="chkBoxTakeCellPhone" runat="server" Text="手机" /><br />
                    <asp:CheckBox ID="chkBoxTakeCellPhone" runat="server" Text="手机" /><br />
 <asp:CheckBox ID="chkBoxTakeCamera" runat="server" Text="相机" /><br />
                    <asp:CheckBox ID="chkBoxTakeCamera" runat="server" Text="相机" /><br />
 <asp:CheckBox ID="chkBoxTakeMP3" runat="server" Text="MP3" /><br />
                    <asp:CheckBox ID="chkBoxTakeMP3" runat="server" Text="MP3" /><br />
 <asp:CheckBox ID="chkBoxTakeEraset" runat="server" Text="耳机" /><br />
                    <asp:CheckBox ID="chkBoxTakeEraset" runat="server" Text="耳机" /><br />
 <asp:CheckBox ID="chkBoxTakeNB" runat="server" Text="笔记本" /><br />
                    <asp:CheckBox ID="chkBoxTakeNB" runat="server" Text="笔记本" /><br />
 <asp:CheckBox ID="chkBoxTakeFlashDrive" runat="server" Text="随身听" /><br />
                    <asp:CheckBox ID="chkBoxTakeFlashDrive" runat="server" Text="随身听" /><br />
 </td>
                  </td>
 <td>
                  <td>
 <asp:CheckBox ID="chkBoxNotTakeCellPhone" runat="server" Text="手机" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeCellPhone" runat="server" Text="手机" /><br />
 <asp:CheckBox ID="chkBoxNotTakeCamera" runat="server" Text="相机" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeCamera" runat="server" Text="相机" /><br />
 <asp:CheckBox ID="chkBoxNotTakeMP3" runat="server" Text="MP3" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeMP3" runat="server" Text="MP3" /><br />
 <asp:CheckBox ID="chkBoxNotTakeEraset" runat="server" Text="耳机" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeEraset" runat="server" Text="耳机" /><br />
 <asp:CheckBox ID="chkBoxNotTakeNB" runat="server" Text="笔记本" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeNB" runat="server" Text="笔记本" /><br />
 <asp:CheckBox ID="chkBoxNotTakeFlashDrive" runat="server" Text="随身听" />
                    <asp:CheckBox ID="chkBoxNotTakeFlashDrive" runat="server" Text="随身听" />
 <br />
                    <br />
 </td>
                  </td>
 </tr>
                </tr>
 <tr>
                <tr>
 <td colspan="2">
                  <td colspan="2">
 <hr />
                    <hr />
 </td>
                  </td>
 </tr>
                </tr>              
 </table>
              </table>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeCellPhone"
               <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeCellPhone"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxTakeCellPhone"
                                                             TargetControlID="chkBoxTakeCellPhone"
 Key="CellPhone">
                                                             Key="CellPhone">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeCellPhone"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeCellPhone"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxNotTakeCellPhone"
                                                             TargetControlID="chkBoxNotTakeCellPhone"
 Key="CellPhone">
                                                             Key="CellPhone">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>

 <%-- 设定「相机」的互斥式复选框 --%>
              <%-- 设定「相机」的互斥式复选框 --%>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeCamera"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeCamera"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxTakeCamera"
                                                             TargetControlID="chkBoxTakeCamera"
 Key="PDA">
                                                             Key="PDA">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakePDA"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakePDA"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxNotTakeCamera"
                                                             TargetControlID="chkBoxNotTakeCamera"
 Key="PDA">
                                                             Key="PDA">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>

 <%-- 设定「MP3」的互斥式复选框 --%>
              <%-- 设定「MP3」的互斥式复选框 --%>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeMP3"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeMP3"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxTakeMP3"
                                                             TargetControlID="chkBoxTakeMP3"
 Key="MP3">
                                                             Key="MP3">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeMP3"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeMP3"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxNotTakeMP3"
                                                             TargetControlID="chkBoxNotTakeMP3"
 Key="MP3">
                                                             Key="MP3">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>

 <%-- 设定「耳机」的互斥式复选框 --%>
              <%-- 设定「耳机」的互斥式复选框 --%>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeEarset"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeEarset"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxTakeEraset"
                                                             TargetControlID="chkBoxTakeEraset"
 Key="Eraset">
                                                             Key="Eraset">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeEarset"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeEarset"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxNotTakeEraset"
                                                             TargetControlID="chkBoxNotTakeEraset"
 Key="Eraset">
                                                             Key="Eraset">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>

 <%-- 设定「笔记本」的互斥式复选框 --%>
              <%-- 设定「笔记本」的互斥式复选框 --%>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeNB"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeNB"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxTakeNB"
                                                             TargetControlID="chkBoxTakeNB"
 Key="NB">
                                                             Key="NB">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeNB"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeNB"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxNotTakeNB"
                                                             TargetControlID="chkBoxNotTakeNB"
 Key="NB">
                                                             Key="NB">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>

 
              
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeFlashDrive"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeFlashDrive"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxTakeFlashDrive"
                                                             TargetControlID="chkBoxTakeFlashDrive"
 Key="FlashDrive">
                                                             Key="FlashDrive">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeFlashDrive"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeFlashDrive"
 runat="server"
                                                             runat="server"
 TargetControlID="chkBoxNotTakeFlashDrive"
                                                             TargetControlID="chkBoxNotTakeFlashDrive"
 Key="FlashDrive">
                                                             Key="FlashDrive">
 </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 </form>
    </form>
 </body>
</body>
 </html>
</html>
 
运行结果:
     
可以应用到页面中的CheckBox上,通过为一组CheckBox指定同样的Key,让它们拥有类似单选按钮组(Radio Button Group)的行为,即用户只能选择组中的某一项。与单选按钮组不同的是,这个由CheckBox组成的单选按钮允许取消选择,即不选择组中的任意一项,而传统的单选按钮组则无法实现这个功能。
属性:
Key:隶属于同一群组的复选框,必须具有独一的键值。
TargetControlID:目标控件ID值。
实例代码:
 <html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">
<head runat="server"> <title>Untitled Page</title>
    <title>Untitled Page</title> </head>
</head> <body>
<body> <form id="form1" runat="server">
    <form id="form1" runat="server"> <asp:ScriptManager ID="sm" runat="server" />
     <asp:ScriptManager ID="sm" runat="server" /> <table>
         <table> <tr>
                <tr> <td colspan="2" >
                  <td colspan="2" > 外出旅游,您会携带‧‧‧
                    外出旅游,您会携带‧‧‧ </td>
                  </td> </tr>
                </tr> <tr>
                <tr> <td style="width: 165px" >
                  <td style="width: 165px" > 会携带
                    会携带 </td>
                  </td> <td style="width: 165px" >
                  <td style="width: 165px" > 不会携带
                    不会携带 </td>
                  </td> </tr>
                </tr> <tr>
                <tr> <td>
                  <td> <asp:CheckBox ID="chkBoxTakeCellPhone" runat="server" Text="手机" /><br />
                    <asp:CheckBox ID="chkBoxTakeCellPhone" runat="server" Text="手机" /><br /> <asp:CheckBox ID="chkBoxTakeCamera" runat="server" Text="相机" /><br />
                    <asp:CheckBox ID="chkBoxTakeCamera" runat="server" Text="相机" /><br /> <asp:CheckBox ID="chkBoxTakeMP3" runat="server" Text="MP3" /><br />
                    <asp:CheckBox ID="chkBoxTakeMP3" runat="server" Text="MP3" /><br /> <asp:CheckBox ID="chkBoxTakeEraset" runat="server" Text="耳机" /><br />
                    <asp:CheckBox ID="chkBoxTakeEraset" runat="server" Text="耳机" /><br /> <asp:CheckBox ID="chkBoxTakeNB" runat="server" Text="笔记本" /><br />
                    <asp:CheckBox ID="chkBoxTakeNB" runat="server" Text="笔记本" /><br /> <asp:CheckBox ID="chkBoxTakeFlashDrive" runat="server" Text="随身听" /><br />
                    <asp:CheckBox ID="chkBoxTakeFlashDrive" runat="server" Text="随身听" /><br /> </td>
                  </td> <td>
                  <td> <asp:CheckBox ID="chkBoxNotTakeCellPhone" runat="server" Text="手机" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeCellPhone" runat="server" Text="手机" /><br /> <asp:CheckBox ID="chkBoxNotTakeCamera" runat="server" Text="相机" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeCamera" runat="server" Text="相机" /><br /> <asp:CheckBox ID="chkBoxNotTakeMP3" runat="server" Text="MP3" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeMP3" runat="server" Text="MP3" /><br /> <asp:CheckBox ID="chkBoxNotTakeEraset" runat="server" Text="耳机" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeEraset" runat="server" Text="耳机" /><br /> <asp:CheckBox ID="chkBoxNotTakeNB" runat="server" Text="笔记本" /><br />
                    <asp:CheckBox ID="chkBoxNotTakeNB" runat="server" Text="笔记本" /><br /> <asp:CheckBox ID="chkBoxNotTakeFlashDrive" runat="server" Text="随身听" />
                    <asp:CheckBox ID="chkBoxNotTakeFlashDrive" runat="server" Text="随身听" /> <br />
                    <br /> </td>
                  </td> </tr>
                </tr> <tr>
                <tr> <td colspan="2">
                  <td colspan="2"> <hr />
                    <hr /> </td>
                  </td> </tr>
                </tr>               </table>
              </table> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeCellPhone"
               <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeCellPhone" runat="server"
                                                             runat="server" TargetControlID="chkBoxTakeCellPhone"
                                                             TargetControlID="chkBoxTakeCellPhone" Key="CellPhone">
                                                             Key="CellPhone"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeCellPhone"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeCellPhone" runat="server"
                                                             runat="server" TargetControlID="chkBoxNotTakeCellPhone"
                                                             TargetControlID="chkBoxNotTakeCellPhone" Key="CellPhone">
                                                             Key="CellPhone"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <%-- 设定「相机」的互斥式复选框 --%>
              <%-- 设定「相机」的互斥式复选框 --%> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeCamera"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeCamera" runat="server"
                                                             runat="server" TargetControlID="chkBoxTakeCamera"
                                                             TargetControlID="chkBoxTakeCamera" Key="PDA">
                                                             Key="PDA"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakePDA"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakePDA" runat="server"
                                                             runat="server" TargetControlID="chkBoxNotTakeCamera"
                                                             TargetControlID="chkBoxNotTakeCamera" Key="PDA">
                                                             Key="PDA"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <%-- 设定「MP3」的互斥式复选框 --%>
              <%-- 设定「MP3」的互斥式复选框 --%> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeMP3"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeMP3" runat="server"
                                                             runat="server" TargetControlID="chkBoxTakeMP3"
                                                             TargetControlID="chkBoxTakeMP3" Key="MP3">
                                                             Key="MP3"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeMP3"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeMP3" runat="server"
                                                             runat="server" TargetControlID="chkBoxNotTakeMP3"
                                                             TargetControlID="chkBoxNotTakeMP3" Key="MP3">
                                                             Key="MP3"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <%-- 设定「耳机」的互斥式复选框 --%>
              <%-- 设定「耳机」的互斥式复选框 --%> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeEarset"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeEarset" runat="server"
                                                             runat="server" TargetControlID="chkBoxTakeEraset"
                                                             TargetControlID="chkBoxTakeEraset" Key="Eraset">
                                                             Key="Eraset"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeEarset"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeEarset" runat="server"
                                                             runat="server" TargetControlID="chkBoxNotTakeEraset"
                                                             TargetControlID="chkBoxNotTakeEraset" Key="Eraset">
                                                             Key="Eraset"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 <%-- 设定「笔记本」的互斥式复选框 --%>
              <%-- 设定「笔记本」的互斥式复选框 --%> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeNB"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeNB" runat="server"
                                                             runat="server" TargetControlID="chkBoxTakeNB"
                                                             TargetControlID="chkBoxTakeNB" Key="NB">
                                                             Key="NB"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeNB"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeNB" runat="server"
                                                             runat="server" TargetControlID="chkBoxNotTakeNB"
                                                             TargetControlID="chkBoxNotTakeNB" Key="NB">
                                                             Key="NB"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
 
               <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeFlashDrive"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeFlashDrive" runat="server"
                                                             runat="server" TargetControlID="chkBoxTakeFlashDrive"
                                                             TargetControlID="chkBoxTakeFlashDrive" Key="FlashDrive">
                                                             Key="FlashDrive"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender> <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeFlashDrive"
              <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeFlashDrive" runat="server"
                                                             runat="server" TargetControlID="chkBoxNotTakeFlashDrive"
                                                             TargetControlID="chkBoxNotTakeFlashDrive" Key="FlashDrive">
                                                             Key="FlashDrive"> </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
              </ajaxToolkit:MutuallyExclusiveCheckBoxExtender> </form>
    </form> </body>
</body> </html>
</html>
运行结果:
 
                    
                 
                
 
 
              
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号