Javascript code to check all checkbox in a gridview
what is the javascript code to check all checkbox in a gridview?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sagar PardeshiRank #103 · 20.8K reputationPosted Feb 13, 2014, 12:10 AM EST
http://www.dotnetgallery.com/kb/resource18-Gridview-header-checkbox-select-and-deselect-all-rows-using-client-side-Jav.aspx
Abhishek KumarRank #510 · 4.8K reputationPosted Feb 13, 2014, 12:51 AM EST
If parentChk would the header check box in the grid and _chk would be the child one.
$(window).bind('load',function()
{
var ParentChk = $(".ParentChk input");
var _Chk = $("._Chk input");
ParentChk .bind("click",function()
{
_Chk.each(function(){this.checked = ParentChk[0].checked;})
});
_Chk.bind("click",function(){if($(this).checked==false)ParentChk[0].checked =false;});
});
Hope this will help .
Many Thanks.