DataGridSelection<T>.SelectedKeys Property

Specifies the keys of the selected data rows.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

public Task<IEnumerable<object>> SelectedKeys { get; }

Property Value

Type Description
Task<IEnumerable<Object>>

The Task object that results the keys of the selected data rows.

Remarks

In the OptimizedMultipleSelectionChanged event handler, use the SelectedKeys property to get the keys of the currently selected data rows asynchronously.

<DxDataGrid Data="@DataSource"
    KeyFieldName="Id"
    SelectionMode="DataGridSelectionMode.OptimizedMultipleSelection"
    OptimizedMultipleSelectionChanged="OnSelectionChanged">
    ...
</DxDataGrid>

@code {
    int SelectedCount { get; set; }

    protected async Task OnSelectionChanged(DataGridSelection<ProductFlat> selection) {
        ...
        var selectedKeys = await selection.SelectedKeys;
        SelectedCount = selectedKeys.Count();
    }
}

Online Demo

Data Grid - Multiple Selection with Optimized Performance

See Also