Thursday, August 25, 2016

Check or Uncheck all CheckBoxes in an ASP.NET GridView using jQuery

var $headerCheckBox = $('.headerSelectAll input[type="checkbox"]');
        var $childCheckBox = $('.childSelect input[type="checkbox"]');
        $($headerCheckBox).change(function () {
            $childCheckBox.each(function () {
                this.checked = $headerCheckBox[0].checked;

        $($childCheckBox).change(function () {
            // if any of the checkbox is unchecked
            // check all checkbox should be cleared
            if (!$(this).is(':checked')) {
            else {
                // if all of the checkbox is checked
                // check all checkbox should be checked
                if ($childCheckBox.length == $childCheckBox.filter(':checked').length) {
                    $headerCheckBox[0].checked = true;


Nandhini said...

I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.
Manpower Services in Chennai

Merlin Maarit said...

It is very helpful for me. Keep blogging like this.

Healthcare Analytics Company

Finance Analytics Company

Telecom Analytics Company

Retail Analytics Company

Analytics Company

US IT Staffing Agency

Karthi Keyan said...

Its fantatic explaintion lot of information gather it...nice article....
seo company in Chennai

Isabella Olivia said...

This information is impressive; I am inspired with your post writing style & how continuously you describe this topic.

Pawn Shop

Pawn Loans

Pawn Shops

Pawn Loan

Pawn Shop near me