I want to add a checkbox in the header that when selected will toggle the checkboxes in all the rows to checked or unchecked. Here is the JavaScript Code to which enables us to Check all CheckBoxes from GridView Header CheckBox. Here Mudassar Ahmed Khan has explained with an example, how to check all (select all) CheckBoxes in WebGrid using a CheckBox in Header row in ASP.Net MVC Razor. Here is two example both are doing different - different work the code given below is for changing the check of all child checkbox of a table, gridview as header checkbox check change and the second code is for changing the check of all checkboxes of the particular specific column as header checkbox check change. Further during the implementation, I faced a validation requirement of “Select at least one checkbox” before proceeding. In the header there is a "check all" checkbox.