Main Menu
Knowledge Base
Product Registration
Log an Incident
Request a Feature
Search Incidents/Bug Reports

Search KB

Please note: In an effort to better serve you, we are in the process of restructuring DevCenter. In the process, we have moved many items that you may be used to finding in DevCenter over to the Main Site. If you are having trouble locating something, please try looking at the following places:

Knowledge Base Article: KB05057

HOWTO:WebGrid: How to check all checkboxes in a column when the header is clicked

The information in this article applies to:
UltraWebGrid (v3.0.20041)
  Article Created: 

Last Updated:

Article Type
How To
Page Options
Average Rating:
4 out of 10

Rate this page
Print this page
E-mail this page
Add to Favorites


This article demonstrates how to loop through the WebGrid rows on the client, then set the values for checkbox cells when a header is clicked within the WebGrid.

Additional Information

The best method for setting the values for all cells in a column when the header is clicked is to handle the client-side ColumnHeaderClick event. Set the handler to be used within the property pages or in code:


UltraWebGrid1.DisplayLayout.ClientSideEvents.ColumnHeaderClickHandler = "UltraWebGrid1_ColumnHeaderClickHandler"

In C#:

UltraWebGrid1.DisplayLayout.ClientSideEvents.ColumnHeaderClickHandler = "UltraWebGrid1_ColumnHeaderClickHandler";

Within that JavaScript handler, first determine which column header was clicked by checking the Key of the column. If the key matches the desired column, loop through the rows and use the setValue() function to change the value of the cell. The following script details how this code should look:

function UltraWebGrid1_ColumnHeaderClickHandler(gridName, columnId, button)

    //Add code to handle your event here.
    var myCol = igtbl_getColumnById(columnId);

    if (myCol.Key == "Subscriber")

         var myGrid = igtbl_getGridById(gridName);

         for (i = 0; i < myGrid.Rows.length; i++)




Setting a value of 1 (to check) or 0 (to un-check) on a cell using the setValue() client-side function affects the checkbox state when the ColumnType of the column is ColumnType.CheckBox (this is declared at design-time or assigned from server-side code). If the ColumnType was not CheckBox, then setting this value onto a cell would overwrite the checkbox with the literal value '1' or '0'.

How would you rate the quality of this content?
Poor -----------------------------------------> Outstanding

Tell us why you rated the content this way. (optional)