GridOptionsSelection.CheckBoxSelectorField Property
Gets or sets the name of the field in the data source that is bound to the check box column.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v22.2.dll
NuGet Package: DevExpress.Win.Grid
Declaration
[DefaultValue("")]
[XtraSerializableProperty]
public virtual string CheckBoxSelectorField { get; set; }
Property Value
Type | Default | Description |
---|---|---|
String | String.Empty | A string value that specifies the name of the field in the data source that is bound to the check box column. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to CheckBoxSelectorField |
---|---|
AdvBandedGridView |
|
GridView |
|
Remarks
Users can use check boxes to select rows in a grid.
To display the check box column:
- enable the ColumnView.OptionsSelection.MultiSelect option
- set the GridView.OptionsSelection.MultiSelectMode option to CheckBoxRowSelect
Use the CheckBoxSelectorField
property to bind the check box column to a field in the data source. When a user selects a row, the change is automatically reflected in the data source.
gridView1.OptionsSelection.MultiSelect = true;
gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
gridControl1.DataSource = GetData();
gridView1.Columns["IsSelected"].Visible = false;
gridView1.OptionsSelection.CheckBoxSelectorField = "IsSelected";
public DataTable GetData() {
DataTable table = new DataTable();
table.Columns.Add("IsSelected", typeof(Boolean));
table.Columns.Add("ID", typeof(String));
for (int i = 0; i < 10; i++)
table.Rows.Add(new object[] { i % 2 == 0 ? true : false, "Item " + i.ToString() });
return table;
}
You can also handle the ColumnView.SelectionChanged event to perform custom actions when a row is selected.