my grid have a client template chechkbox and a header template for masterchechkbox.
columns.Bound(m => m.DegreeId).ClientTemplate(@"<input type='checkbox' value='#= DegreeId #' name='chkboxForRequirments'/>").HeaderTemplate("<input type='checkbox' id='chkAll' onclick='SelectAll();'/>")
.HtmlAttributes(new { style = "text-align:center" }).Width(30);
i want to select all client template chechkbox by using master chechkbox.
var chkboxForRequirments = document.getElementsByName("chkboxForRequirments");
$("#chkAll").click(function (e) {
if($(this).is(':checked'))
{
$(this).prop('checked', true)
for (i = 0; i < chkboxForRequirments.length; i++)
{
chkboxForRequirments[i].checked = true;
}
}
else {
for (i = 0; i < chkboxForRequirments.length; i++) {
chkboxForRequirments[i].checked = false;
}
}
});
but the problem is a single page data is selected all grid data is not selected.if i go to next page then this page data can be selected. how can i select grid all checkbox at a click of masterchechk box.
Aucun commentaire:
Enregistrer un commentaire