Category / Section
How to make a checkbox column to recognize values of Yes and No as True and False in WinForms GridGroupingControl?
1 min read
Customize the checkbox column
In order to set the checkbox for a column, Appearance.AnyRecordFieldCell.CellType property of that particular column can be set as CheckBox. The checked and unchecked value can be changed by using the CheckBoxOptions property.
C#
this.gridGroupingControl1.TableDescriptor.Columns[2].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.CheckBox; //To set 'Y' and 'N' instead of "True" and "False" this.gridGroupingControl1.TableDescriptor.Columns[2].Appearance.AnyRecordFieldCell.CheckBoxOptions = new GridCheckBoxCellInfo("Y", "N", "", true); this.gridGroupingControl1.TableDescriptor.Columns[2].Appearance.AnyRecordFieldCell.Description = "Check";
VB
Me.gridGroupingControl1.TableDescriptor.Columns(2).Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.CheckBox 'To set 'Y' and 'N' instead of "True" and "False" Me.gridGroupingControl1.TableDescriptor.Columns(2).Appearance.AnyRecordFieldCell.CheckBoxOptions = New GridCheckBoxCellInfo("Y", "N", "", True) Me.gridGroupingControl1.TableDescriptor.Columns(2).Appearance.AnyRecordFieldCell.Description = "Check"
Note:
In this example, the checked and unchecked values are assigned as respectively “Y” and “N”. If the cell value is “Y”, the checkbox will be checked and if the cell value is “N”, the checkbox will be unchecked.