Skip to main content

DxGrid.ClearSelection() Method

Clears selection.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.1.dll

NuGet Package: DevExpress.Blazor


public void ClearSelection()


Grid rows can be selected in the following ways:

  • Users click rows to select them. To enable this functionality, set the AllowSelectRowByClick property to true.
  • Users click checkboxes or radio buttons in the selection column. To display this column, declare a DxGridSelectionColumn object in the Columns template.
  • You call the Select* method. Refer to the Grid’s member table for the list of available methods.

Call the ClearSelection method to clear selection of all rows on all pages.

@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable

<DxGrid Data="GridDataSource"
        <DxGridDataColumn FieldName="ProductName" />
        <DxGridDataColumn FieldName="UnitPrice" />
        <DxGridDataColumn FieldName="QuantityPerUnit" />
        <DxGridDataColumn FieldName="UnitsInStock" />
<br />

<DxButton Click="() => MyGrid.ClearSelection()">Clear Selection</DxButton>

@code {
    IEnumerable<object> GridDataSource { get; set; }
    NorthwindContext Northwind { get; set; }
    IReadOnlyList<object> SelectedDataItems { get; set; }
    IGrid MyGrid { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        GridDataSource = Northwind.Products
        SelectedDataItems = GridDataSource.Skip(1).Take(2).ToList();

    public void Dispose() {

Blazor Grid Select and Deselect Data Item

Run Demo: Data Grid - Selection API

For more information about selection in the Grid control, refer to the following topic: Selection and Focus in Blazor Grid.


See Also