javascript code to check all checkbox in a gridview
what is the javascript code to check all checkbox in a gridview?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhishek KumarPosted Feb 13, 2014, 5:51 AM
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.
Sagar PardeshiPosted Feb 13, 2014, 5:10 AM
http://www.dotnetgallery.com/kb/resource18-Gridview-header-checkbox-select-and-deselect-all-rows-using-client-side-Jav.aspx