DataGridHtmlRowDecorationEventArgs<T>.RowType Property

Gets the processed row’s type.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

public DataGridHtmlRowDecorationType RowType { get; }

Property Value

Type Description
DataGridHtmlRowDecorationType

A DataGridHtmlRowDecorationType enumeration value that specifies the row’s type.

Available values:

Name Description
DataRow

Corresponds to a data row.

DetailRow

Corresponds to a detail row.

GroupRow

Corresponds to a group row.

EditFormRow

Corresponds to a row that contains the Edit Form.

Remarks

The RowType value defines the HtmlRowDecoration event arguments’ type:

The corresponding arguments allow you to decorate grid rows of a specified type (for example, all data rows) in the same manner. The code below applies different CSS classes to different grid rows (subject to their RowType property values).

<DxDataGrid Data="@forecasts"
            PageSize="5"
            HtmlRowDecoration="@OnHtmlRowDecoration">
    <DxDataGridCommandColumn />
    <DxDataGridDateEditColumn Field="@nameof(WeatherForecast.Date)" DisplayFormat="D" EditorFormat="D" />
    <DxDataGridColumn Field="@nameof(WeatherForecast.Forecast)"  />
    <DxDataGridSpinEditColumn Field="@nameof(WeatherForecast.TemperatureC)" Caption="@("Temp. (\x2103)")" />
    <DxDataGridComboBoxColumn Field="@nameof(WeatherForecast.CloudCover)" DataAsync="@ForecastService.GetCloudCoverAsync" />
    <DxDataGridCheckBoxColumn Field="@nameof(WeatherForecast.Precipitation)" />
</DxDataGrid>

@code {
    WeatherForecast[] forecasts;

    protected override async Task OnInitializedAsync() { 
        forecasts = await ForecastService.GetForecastAsync();
    }

    void OnHtmlRowDecoration(DataGridHtmlRowDecorationEventArgs<WeatherForecast> eventArgs) {
        switch (eventArgs.RowType) {

            case DataGridHtmlRowDecorationType.DataRow:
                eventArgs.CssClass += " table-light";
                break;
            case DataGridHtmlRowDecorationType.EditFormRow:
                eventArgs.CssClass += " table-primary";
                break;
            default:
                eventArgs.CssClass += " table-reflow";
                break;
        }
    }
}

DataGrid Row Type

See Also