Skip to main content

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.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

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
GridView
.OptionsSelection .CheckBoxSelectorField

Remarks

Users can use check boxes to select rows in a grid.

image

To display the check box column:

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.

Read the following topic for detailed information: Selection Binding.

Important

Do not use Selection Binding in Instance Feedback Mode. When selection Binding is enabled, the grid control processes data as in normal mode, negating all the advantages of Instant Feedback mode.

See Also