Monday, 21 May 2012

you can not check multiple check box from check box list in asp.net using jquery

 <script type ="text/javascript">
        $(document).ready(function () {
            var checkboxes = $('#<%=ChkListName.ClientID %>').find('input:checkbox');
            checkboxes.click(function () {
                var selectedIndex = checkboxes.index($(this));
                var items = $('#<% = ChkListName.ClientID %> input:checkbox');
                for (i = 0; i < items.length; i++) {
                    if (i == selectedIndex)
                        items[i].checked = true;
                    else
                        items[i].checked = false;
                }
            });
        });
    </script>

No comments:

Post a Comment