Skip to main content

GridViewSettings.HtmlRowPrepared Property

Enables the settings of individual rows to be changed.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v23.2.dll

NuGet Package: DevExpress.Web.Mvc5


public ASPxGridViewTableRowEventHandler HtmlRowPrepared { get; set; }

Property Value

Type Description

A ASPxGridViewTableRowEventHandler delegate method allowing you to implement custom processing.


The HtmlRowPrepared event is raised for each row, displayed within the current page, when the corresponding HTML table row has been prepared, but has not yet been rendered. You can handle this event to change the style settings of individual rows.


The code sample below demonstrates how to change the style of a row based on one of its values.

View code:

@Html.DevExpress().GridView(settings => {
    settings.Name = "GridView";
    settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewPartial" };
    settings.KeyFieldName = "ProductID";
    // ...

    // Discontinued items are displayed in gray font.
    settings.HtmlRowPrepared = (s, e) => {
        if (Convert.ToBoolean(e.GetValue("Discontinued")) == true) {
            e.Row.ForeColor = System.Drawing.Color.DarkGray;

The image below illustrates the result.


See Also