We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How do I place a CheckBox in a header cell of the GridGroupingControl?

A CheckBox can be placed in a header cell of the GridGroupingControl by handling the QueryCellStyleInfo event.

 

C#

VB

 

By default, the selected cell’s MouseController calls the Cellrenderer’s MouseUp that in turn raises the CheckBoxClick. The DragGroupHeader MouseController for the header cells does not call the Renderer’s MouseUp. So you have to explicitly call the Renderer’s Mouseup from the TableControl’s Mouseup checking for the MouseController type.

 

C#

VB

 

By default, when the header is clicked, the sorting operation is done in the columns. To avoid this, the sorting is disabled in the header by providing the following code.

 

C#

 

VB

 

The value of the CheckBox can be received through the SaveCellText handler that saves the value from the Grid. In the given sample, a temporary variable (CheckBoxValue) has been used to keep the modified value of the CheckBox and this value is refreshed through the QueryCellStyleInfo event.

 

C#

 

VB

 

When the CheckBox is clicked, it enables/disables all the check boxes in the column except the header cell.

 

C#

 

VB

After applying the properties, the Grid is shown as follows,

Figure 1: Enabling the CheckBoxes in the column

Sample Links

CS: CheckBox_in_header

VB: CheckBox_in_header

Article ID: Published Date: Last Revised Date: Platform: Control:
688 04/30/2011 09/25/2018 Windows Forms GridGroupingControl
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.