Skip to main content
A newer version of this page is available. .

DataRowInfo<T>.RowIndex Property

Returns a data row’s index.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public int RowIndex { get; }

Property Value

Type Description
Int32

A zero-based row index.

Remarks

Use the RowPreviewTemplate‘s Context parameter to access the RowIndex property. This template allows you to show preview sections under each data row across all columns.

<DxDataGrid Data="@DataSource">
    <Columns>
        <DxDataGridColumn Field="@nameof(Employee.FirstName)" SortOrder="DataGridColumnSortOrder.Ascending"></DxDataGridColumn>
        ...
    </Columns>
    <RowPreviewTemplate Context="ItemInfo">
        @{
            Employee employee = ItemInfo.DataItem;
        }
        @if (ItemInfo.RowIndex % 2 == 0) {
            <span class="mr-3">@employee.Notes</span>
        } 
        else {
            <span class="mr-3" style="color:darkblue;">@employee.Notes</span>
        }
    </RowPreviewTemplate>
</DxDataGrid>
See Also