Grid code
columns: grid.Columns( grid.Column(format: @ <input type="checkbox" @(item.Conf_Is_Approved == true ? " disabled='disabled'" : null) value="@item.Conf_ID" name="ids" /> , header: "{checkall}"),))<script>
columns: grid.Columns(
grid.Column(format: @ <input type="checkbox" @(item.Conf_Is_Approved == true ? " disabled='disabled'" : null) value="@item.Conf_ID" name="ids" /> , header: "{checkall}"),
))
<script>
$(document).ready(function () { //2nd click event for header checkbox for select /deselect all $(document).on("click", "#cbSelectAll", function () { var ischecked = this.checked; //alert(ischecked); // jQuery 1.7+ $('#checkableGrid').find("input:checkbox").each(function () { this.checked = ischecked; }); }); });
$(document).ready(function ()
{
//2nd click event for header checkbox for select /deselect all
$(document).on("click", "#cbSelectAll", function () {
var ischecked = this.checked; //alert(ischecked); // jQuery 1.7+
$('#checkableGrid').find("input:checkbox").each(function () {
this.checked = ischecked;
}); }); });
$("#checkableGrid th").each(function ()
if ($.trim($(this).text().toString().toLowerCase()) === "{checkall}")
$(this).text('');
$("<input />", { type: "checkbox", id: "cbSelectAll", value: "" }).appendTo($(this));
$(this).append(" All");
}
}); //3rd click event for checkbox of each row
$("input[name='ids']").click(function () { //alert('hi');
var totalRows = $("#checkableGrid td :checkbox").length;
var checked = $("#checkableGrid td :checkbox:checked").length;
if (checked == totalRows) {
$("#checkableGrid").find("input:checkbox").each(function () {
this.checked = true;
});
else {
$("#cbSelectAll").removeAttr("checked");
script>
Attachment: aaaa.rar