windowsforms-16439-controls-and-libraries-data-grid-focus-and-selection-handling-multiple-row-selection-via-built-in-check-column-and-selection-binding.md
The GridView, BandedGridView, and AdvBandedGridView views support multiple row selection using a built-in Check column. When this feature is enabled, end users can use checkboxes to toggle the selection state of certain rows, all rows, or data group rows.
Run Demo: Web Style Row Selection
View Example: How to use an unbound checkbox column to select data rows
To enable row selection with the built-in Check column, set the properties as follows:
gridView1.OptionsSelection.MultiSelect = true;
gridView1.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect;
GridView1.OptionsSelection.MultiSelect = True
GridView1.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect
The checkbox in the Check column header allows you to select/deselect all grid rows. Use the GridOptionsSelection.ShowCheckBoxSelectorInColumnHeader property to hide this checkbox.
Group rows can also contain checkboxes if the GridOptionsSelection.ShowCheckBoxSelectorInGroupRow property value is True. These checkboxes switch the selection states of rows that belong to specific groups.
Specify the GridOptionsSelection.CheckBoxSelectorField property to bind the Check column to a field in the bound data source. When you change a row’s selection state (using the Check column or in code), the grid automatically updates the specified data source field.
The Check column’s bound mode has the following advantages — in contrast to the default (unbound) mode:
Tip
In Check column bound mode, multiple row selection may lead to performance issues due to excessive data source updates. For instance, this may occur when clicking the check box embedded in the Check column’s header for a grid bound to a large data source. Disable the GridOptionsSelection.ShowCheckBoxSelectorInColumnHeader property for large data sources, or alternatively, use the Check column in unbound mode.
Important
Do not use Selection Binding in Instant Feedback Mode. When selection Binding is enabled, the grid control processes data as in normal mode, negating all the advantages of Instant Feedback mode.
The GridOptionsSelection.ShowCheckBoxSelectorInPrintExport property specifies the Check column’s visibility in printed/exported documents.
Handle the ColumnView.SelectionChanged event to perform actions when the selection is changed.
See the following topic to learn about the methods used to select rows in code, retrieve and delete the selected rows, or copy them to the Clipboard: Multiple Row and Cell Selection.
See Also