Skip to main content
All docs
V26.1
  • GridFocusedRowChangedEventArgs.VisibleIndex Property

    Returns the visible index of the focused row.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.Grid.v26.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public int VisibleIndex { get; }

    Property Value

    Type Description
    Int32

    If a data row is focused, the property returns this row’s visible index. The property returns -1 if a group or new row is focused or the Grid displays no rows.

    Remarks

    The Grid component assigns indexes to visible data and group rows to indicate row order. Indexes are zero-based and sequential across all Grid pages.

    Row Indexes - All Pages

    DxGrid reassigns row indexes each time users sort, filter, group data, or expand or collapse group rows. Filtered-out rows and rows in collapsed groups do not have indexes. In the following image, the Grid component does not assign indexes to data rows in the collapsed Partly cloudy group.

    Row Indexes - Group Rows

    Refer to the GridFocusedRowChangedEventArgs class description for additional information.

    <DxGrid @ref="Grid" Data="GridData" PageSize="5"
            FocusedRowEnabled="true"
            FocusedRowChanged="e => rowNumber = e.VisibleIndex + 1">
        <Columns>
            <DxGridDataColumn FieldName="FirstName" />
            <DxGridDataColumn FieldName="LastName" />
            <DxGridDataColumn FieldName="Title" />
            <DxGridDataColumn FieldName="HireDate" />
        </Columns>
    </DxGrid>
    <text>The focused row number is @rowNumber</text>
    @code {
        IGrid Grid { get; set; }
        int rowNumber { get; set; }
    
        object GridData { get; set; }
        protected override async Task OnInitializedAsync() {
            GridData = await NwindDataService.GetEmployeesAsync();
        }
    }
    
    See Also