Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Checkbox column and checkbox in column header in ultrawebgrid


I have created a templated column and a templated column header. Here is the code snippet:

    <igtbl:UltraGridBand key="ugb1">
      <igtbl:TemplatedColumn Key="check" Type="CheckBox" AllowUpdate="Yes">
                  <input id="chkSelectAll" name="SelectAll" type="checkbox" onclick="chkSelectAll_CheckedChanged" AutoPostBack="true"  />

The ultrawebgrid shows a column containing checkboxes, and the header of the same column contains a checkbox. 
I want a c# function chkSelectAll_CheckedChanged, which is called when the checkbox in header column is clicked.
It should select all the checkboxes in all the rows, if they are not already selected(i.e. if only some or none of them are selected). And if all of them are selected, it should deselect them.

I am using .net 4.0 framework.

Please help with the c# code which that function should contain.

  • 49378
    Verified Answer

    Hi sh2311g,

    Thank you for posting in the community.

    In this scenario I suggest that you use an ASP Checkbox control in your column header's template:


     <asp:CheckBox ID="headerCheckbox" runat="server" AutoPostBack="True"
                                oncheckedchanged="headerCheckbox_CheckedChanged" />

    Here is also some sample code for the server-side handler:

        public void headerCheckbox_CheckedChanged(object sender, EventArgs e)
            CheckBox header = sender as CheckBox;

            if (header.Checked)
                foreach (UltraGridRow row in UltraWebGrid1.Rows)
                    row.Cells.FromKey("CheckboxCol").Value = true;

                foreach (UltraGridRow row in UltraWebGrid1.Rows)
                    row.Cells.FromKey("CheckboxCol").Value = false;




    With this setup you would need to uncheck the header checkbox any time a row checbox is deselected. You may also find the following guide for checking all checkboxes in a column client-side useful:

    Please note that the UltraWebGrid control is now outdated and as of .NetAdvantage 2011 Volume 2 is no longer included in our product package. I would suggest that you consider switching to the WebDataGrid/WebHieararchicalDataGrid. More information regarding these controls is available at:

    Additional samples demonstrating the features of these grids can be found at:

    Feel free to contact me if you have any questions.

  • 5

    HELLO ,

    Can anyone please provide me with a code that takes the value of checked rows as I require to do a delete operation on selected/checked rows in UltraGrid.

    Thanks In advance.