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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I put a CheckBox in a header cell in the GridControl or the GridDataBoundGrid?

Platform: WinForms |
Control: GridDataBoundGrid(Classic) |
Published Date: February 12, 2015 |
Last Revised Date: February 8, 2017
Tags: formatting

GridControl:

To put a CheckBox in the GridControl, set the CellType to CheckBox and assign string values for the CheckedValue and UncheckedValue in the CheckBoxOptions property. The value of the CheckBox can be stored to a particular cell in the GridControl and the CheckBoxClick event gets triggered when the CheckBox is clicked.

 

The following is the code example for GridControl.

C#

 

VB

 

GridDataBoundGrid:

To put a CheckBox in the GridDataBoundGrid, two events have to be used. The QueryCellInfo event is used to set the style properties and the SaveCellInfo event is used to save the cell's value. The value of the CheckBox cannot be stored in the GridDataBoundGrid, so any datatype/collection can be used to store the value. The CheckBoxClick event gets triggered when the CheckBox is clicked.

 

In the following code example, the CheckBox is added to the Column header on the GridDataBoundGrid.

C#

 

VB

 

In the following screenshot, the CheckBox is added to the Column header on the GridControl and GridDataBoundGrid.

Figure 1: CheckBox in the Header for GridControl and GridDataBoundGrid

Sample Link

C#: CheckBox HeaderCell CS

VB: CheckBox HeaderCell VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon