DataGridHtmlRowDecorationEventArgs<T>.VisibleIndex Property

Gets the visible index of the processed row.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

public int VisibleIndex { get; }

Property Value

Type Description
Int32

A zero-based integer value that specifies the data row’s visible index.

Remarks

The code below uses the HtmlRowDecoration event and its VisibleIndex attribute to decorate even rows in the Data Grid.

<DxDataGrid Data="@Vacancies"
            ShowGroupPanel="true"
            HtmlRowDecoration="@OnHtmlRowDecoration">
        <DxDataGridColumn Field="@nameof(Vacancy.Id)" Width="70px" AllowGroup="false"></DxDataGridColumn>
        <DxDataGridColumn Field="@nameof(Vacancy.Description)"></DxDataGridColumn>
        <DxDataGridComboBoxColumn Field="@nameof(Vacancy.Region)" Data="@VacancyRepository.Regions" GroupIndex="0"></DxDataGridComboBoxColumn>
        <DxDataGridColumn Field="@nameof(Vacancy.City)" GroupIndex="1"></DxDataGridColumn>
</DxDataGrid>

@code {
    IEnumerable<Vacancy> Vacancies;

    void OnHtmlRowDecoration(DataGridHtmlRowDecorationEventArgs<Vacancy> eventArgs) { 
        if (eventArgs.VisibleIndex % 2 == 1)
            eventArgs.CssClass += " table-secondary";
    }
}

DataGrid Row Visible Index

See Also