Grid Selection
The Grid component supports row and cell selection. When you select a row or a cell, they will be highlighted in the Grid. This article provides an overview of the Grid selection behavior and configuration:
- Enable row or cell selection
- Use single or multiple selection
- Access selected rows or cells
- Handle selection events
- Combine selection with other Grid features
Enable Row or Cell Selection
You can configure the Grid either for row or cell selection:
- To enable row selection:
- Set the Grid
SelectionMode
parameter or - Add a
<GridSelectionSettings>
tag to the<GridSettings>
tag, and set theSelectionType
parameter toGridSelectionType.Row
. - Optionally, you can also select rows through the checkbox column.
- Set the Grid
- To enable cell selection:
- Add a
<GridSelectionSettings>
tag to the<GridSettings>
tag, and set theSelectionType
parameter toGridSelectionType.Cell
.
- Add a
See Rows Selection Basics and Cells Selection Basics for more details.
Use Single or Multiple Selection
You can configure the selection behavior by setting the Grid SelectionMode
parameter to a member of the Telerik.Blazor.GridSelectionMode
enum. The Grid supports the following selection modes:
-
None
(default)—Disables row and cell selection. -
Single
—Allows the user to select only one cell or row at a time. If the user attempts to select multiple cells or rows sequentially, only the most recent selection will take effect. -
Multiple
—Allows the user to select multiple rows or cells at a time.
Access Selected Rows or Cells
The Grid exposes two parameters to get or set its selected rows and cells.
- Use the
SelectedItems
parameter (IEnumerable<T>
) to access the selected rows. - Use the
SelectedCells
parameter (IEnumerable<GridSelectedCellDescriptor>
) to access the selected cells.
Both parameters support two-way binding. You can also use the parameters to pre-select rows or cells for your users.
See Rows Selection Basics and Cells Selection Basics for more details.
Events
You can respond to the user action of selecting a new item through the Grid events:
- Use the
SelectedItemsChanged
event to respond to row selection. - Use the
SelectedCellsChanged
event to respond to cell selection.
Integration with Other Grid Features
The selection feature behavior may differ when the Grid configuration includes row or cell selection and other Grid features. In these situations, certain limitations might arise, or additional adjustments may be required.
See Rows Selection and Other Grid Features and Cells Selection and Other Grid Features for more details.