zoukankan      html  css  js  c++  java
  • MutuallyExlcusiveCheckBox控件

    功能:
        可以应用到页面中的CheckBox上,通过为一组CheckBox指定同样的Key,让它们拥有类似单选按钮组(Radio Button Group)的行为,即用户只能选择组中的某一项。与单选按钮组不同的是,这个由CheckBox组成的单选按钮允许取消选择,即不选择组中的任意一项,而传统的单选按钮组则无法实现这个功能。

    属性:
         Key:隶属于同一群组的复选框,必须具有独一的键值。
         TargetControlID:目标控件ID值。
    实例代码:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        
    <title>Untitled Page</title>
    </head>
    <body>
        
    <form id="form1" runat="server">
         
    <asp:ScriptManager ID="sm" runat="server" />
             
    <table>
                    
    <tr>
                      
    <td colspan="2" >
                        外出旅游,您会携带‧‧‧
                      
    </td>
                    
    </tr>
                    
    <tr>
                      
    <td style=" 165px" >
                        会携带
                      
    </td>
                      
    <td style=" 165px" >
                        不会携带
                      
    </td>
                    
    </tr>
                    
    <tr>
                      
    <td>
                        
    <asp:CheckBox ID="chkBoxTakeCellPhone" runat="server" Text="手机" /><br />
                        
    <asp:CheckBox ID="chkBoxTakeCamera" runat="server" Text="相机" /><br />
                        
    <asp:CheckBox ID="chkBoxTakeMP3" runat="server" Text="MP3" /><br />
                        
    <asp:CheckBox ID="chkBoxTakeEraset" runat="server" Text="耳机" /><br />
                        
    <asp:CheckBox ID="chkBoxTakeNB" runat="server" Text="笔记本" /><br />
                        
    <asp:CheckBox ID="chkBoxTakeFlashDrive" runat="server" Text="随身听" /><br />
                      
    </td>
                      
    <td>
                        
    <asp:CheckBox ID="chkBoxNotTakeCellPhone" runat="server" Text="手机" /><br />
                        
    <asp:CheckBox ID="chkBoxNotTakeCamera" runat="server" Text="相机" /><br />
                        
    <asp:CheckBox ID="chkBoxNotTakeMP3" runat="server" Text="MP3" /><br />
                        
    <asp:CheckBox ID="chkBoxNotTakeEraset" runat="server" Text="耳机" /><br />
                        
    <asp:CheckBox ID="chkBoxNotTakeNB" runat="server" Text="笔记本" /><br />
                        
    <asp:CheckBox ID="chkBoxNotTakeFlashDrive" runat="server" Text="随身听" />
                        
    <br />
                      
    </td>
                    
    </tr>
                    
    <tr>
                      
    <td colspan="2">
                        
    <hr />
                      
    </td>
                    
    </tr>              
                  
    </table>
                   
    <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeCellPhone"
                                                                 runat
    ="server"
                                                                 TargetControlID
    ="chkBoxTakeCellPhone"
                                                                 Key
    ="CellPhone">
                  
    </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
                  
    <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeCellPhone"
                                                                 runat
    ="server"
                                                                 TargetControlID
    ="chkBoxNotTakeCellPhone"
                                                                 Key
    ="CellPhone">
                  
    </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>

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

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

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

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

                  
                  
    <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeTakeFlashDrive"
                                                                 runat
    ="server"
                                                                 TargetControlID
    ="chkBoxTakeFlashDrive"
                                                                 Key
    ="FlashDrive">
                  
    </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
                  
    <ajaxToolkit:MutuallyExclusiveCheckBoxExtender ID="mecbeNotTakeFlashDrive"
                                                                 runat
    ="server"
                                                                 TargetControlID
    ="chkBoxNotTakeFlashDrive"
                                                                 Key
    ="FlashDrive">
                  
    </ajaxToolkit:MutuallyExclusiveCheckBoxExtender>
        
    </form>
    </body>
    </html>

    运行结果:
        
  • 相关阅读:
    深入了解JVM-方法区
    Mysql性能调优
    基督教 犹太  新教  东正教 天主教
    caffe的matlab接口一览表
    ubuntu下 编译Caffe的Matlab接口
    Linux入门学习教程:虚拟机体验之KVM篇
    利用proxychains在终端使用socks5代理
    process lasso 优化原理
    解决win7和ubuntu双系统ubuntu不能上网的问题
    调试minix内核
  • 原文地址:https://www.cnblogs.com/abcdwxc/p/950114.html
Copyright © 2011-2022 走看看