Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxGrid.GetStartRowVisibleIndex() Method

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
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