Skip to main content

DxGrid.GetStartRowVisibleIndex() Method

Gets the visible index of the first row on the current page.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public int GetStartRowVisibleIndex()

Returns

Type Description
Int32

The row’s visible index.

Remarks

In the following code snippet, the label displays the visible index of the first row on a page when you navigate pages in the grid.

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

<DxGrid @ref="@MyGrid"
        PageIndexChanged="Grid_PageIndexChanged"
        Data="@GridDataSource">
    <Columns>
        <DxGridDataColumn FieldName="Country" />
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="OrderDate" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" />
        <DxGridDataColumn FieldName="Quantity" />
    </Columns>
</DxGrid>

<p></p>
Start Row's Visible Index: @StartRowIndex
<p></p>
@* ... *@
@code {
    IGrid MyGrid { get; set; }
    @* ... *@
    object StartRowIndex;
    object GridDataSource { get; set; }
    NorthwindContext Northwind { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        GridDataSource = Northwind.Invoices
            .ToList();
    }
    @* ... *@
    void Grid_PageIndexChanged() {
        StartRowIndex = MyGrid.GetStartRowVisibleIndex();
    }

    public void Dispose() {
        Northwind?.Dispose();
    }
}

DevExpress Blazor Grid - Paging

See Also