GridOptionsSelection.CheckBoxSelectorField Property
Gets or sets the name of the field in the underlaying data source which is bound to the check box column.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v18.2.dll
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 underlaying data source which 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
If the multiple row selection through the check box column is enabled (see ColumnViewOptionsSelection.MultiSelect, GridOptionsSelection.MultiSelectMode), the grid control displays the built-in check box column by default. To respond to selection changes, you can handle the ColumnView.SelectionChanged event. For instance, you can reflect selection changes in the bound data source.
It also possible to bound the check box column to a field in the data source using the CheckBoxSelectorField property. In this case, the data source is automatically updated when the selection changes.
gridView1.OptionsSelection.MultiSelect = true;
gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
gridControl1.DataSource = FillTable();
gridView1.Columns["IsSelected"].Visible = false;
gridView1.OptionsSelection.CheckBoxSelectorField = "IsSelected";
public DataTable FillTable() {
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;
}