DxDataGrid<T>.SetDataRowSelectedByKey(Object, Boolean) Method
Specifies selection state of a data row with the specified key.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v22.1.dll
Declaration
public Task SetDataRowSelectedByKey(
object keyValue,
bool selected
)
Parameters
Name | Type | Description |
---|---|---|
keyValue | Object | A data row key. |
selected | Boolean | true to select a row; otherwise, false. |
Returns
Type | Description |
---|---|
Task | An asynchronous operation that specifies a data row’s selection state. |
Remarks
Important
The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.
Use the SetDataRowSelectedByKey method to select or clear selection from a row by its key.
<DxDataGrid @ref="@grid"
Data="@DataSource"
KeyFieldName="ID"
SelectionMode="DataGridSelectionMode.OptimizedMultipleSelection">
...
</DxDataGrid>
@code {
DxDataGrid<Product> grid;
IEnumerable<Product> DataSource;
protected override async Task OnAfterRenderAsync(bool firstRender) {
if (firstRender) {
for (int i = 0; i < 10; i++)
await grid.SetDataRowSelectedByKey(i, true);
}
// ...
}
}
Online Demo
See Also