Showing posts with label How to select Only One CheckBox In Grid View. Show all posts
Showing posts with label How to select Only One CheckBox In Grid View. Show all posts

Friday 2 December 2011

How to select Only One CheckBox In Grid View

 <script type="text/javascript">
     function CheckOne(obj) {
         var grid = obj.parentNode.parentNode.parentNode;
         var inputs = grid.getElementsByTagName("input");
         for (var i = 0; i < inputs.length; i++) {
             if (inputs[i].type == "checkbox") {
                 if (obj.checked && inputs[i] != obj && inputs[i].checked) {
                     inputs[i].checked = false;
                 }
             }
         }
     }
    </script>


and Use This

<asp:CheckBox ID="chkSelect" runat="server" onclick ="CheckOne(this)"
     />