How to provide checkall option to select and deselect all checkboxes in Gridmvc

@Html.Grid(Model).Columns(columns =>
{
columns.Add(m => m.TagId)
.Titled("")
.Sanitized(false)
.Encoded(false)
.RenderValueAs(d => Html.CheckBox("Checked", false));
columns.Add(alarm => alarm.DomainName).Titled("Domain");
columns.Add(alarm => alarm.GroupName).Titled("Groups").Sortable(true);
}).Sortable(true)

above is my Gridmvc in MVC,here i want to provide checkall option in the header of the grid and also id to that checkbox

Answers


Its not jquery variable its javascript array for you. Need to use js push() function to create that array. like this

var mydata = new Array();
for (var i = 0, il = ids.length; i < il; i++) {
 mydata.push(ids[i]);
}

This should do the trick.


Need Your Help

Add lines to tabular-inline, after saving... django-admin

django django-models django-admin

first of all want to thank in advance all the help you provide to the global community, it is an invaluable service. I write code as a hobby, and now I want to finish a project (my very first) that I