0 Replies - 1441 Views - Last Post: 19 October 2011 - 02:16 AM

#1 hemantwithu   User is offline

  • New D.I.C Head
  • member icon

Reputation: 5
  • View blog
  • Posts: 31
  • Joined: 18-October 11

[jQuery] Check and Uncheck the GridView CheckBox

Posted 19 October 2011 - 02:16 AM

Description: To use this function common to Asp.Net Programmers who uses this requirement. Steps to Change in this Function: 1.Change the GridView ID. 2.Change the Header Check box ID. 3.Change the all rows having Check box ID also. Hope this will be helpful to everyone :-)This Snippet is used to Check and Uncheck the Check boxes of the grid view.Some times we find a requirement to check the Check box which is in the header and to check the each row check box.
function CheckUncheckAllCheckBoxAsNeeded() {
            var totalCheckboxes = $("#gv1 input[id*='chckAll']:checkbox").size();
            var checkedCheckboxes = $("#gv1 input[id*='chckAll']:checkbox:checked").size();
            if (totalCheckboxes == checkedCheckboxes) {
                $("#gv1 input[id*='chckbxOneByOne']:checkbox").attr('checked', true);
            else {
                $("#gv1 input[id*='chckbxOneByOne']:checkbox").attr('checked', false);

Is This A Good Question/Topic? 0
  • +

Page 1 of 1