Skip to main content

IGrid Interface

An interface that defines the DxGrid component’s API members (properties and methods).

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor


public interface IGrid


We recommend that you use the IGrid interface when you access Grid API members in any of the following cases:

  • You use the @ref attribute to reference a Grid object. For example, you set or change values of the Grid parameters outside the component’s markup.
  • You access a Grid object from templates or event handlers.

In all other cases, bind your data to Grid parameters.

The following code snippet changes multiple sort options in the Grid. Note that when you change a Grid parameter that causes the Grid to update or you need to prevent excessive component redraw operations, enclose your code between the BeginUpdate() and EndUpdate() method calls.

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

<DxGrid Data="@Data" @ref="MyGrid">
        <DxGridDataColumn FieldName="Country" SortIndex="0" />
        <DxGridDataColumn FieldName="City" SortIndex="1" />
        <DxGridDataColumn FieldName="OrderDate" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" />
        <DxGridDataColumn FieldName="Quantity" />
<br />

<DxButton Click="@(() => ChangeSortInfo())">Change Sort Options</DxButton>

@code {
    object Data { get; set; }
    NorthwindContext Northwind { get; set; }
    IGrid MyGrid { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        Data = Northwind.Invoices

    void ChangeSortInfo() {
        MyGrid.SortBy("UnitPrice", GridColumnSortOrder.Descending);

    public void Dispose() {

Blazor Grid Multiple Changes

See Also