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

ASPxGridView.HtmlRowPrepared Event

Enables the settings of individual rows to be changed.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll


public event ASPxGridViewTableRowEventHandler HtmlRowPrepared

Event Data

The HtmlRowPrepared event's data class is ASPxGridViewTableRowEventArgs. The following properties provide information specific to this event:

Property Description
KeyValue Gets an object that uniquely identifies the row.
Row Gets the processed row.
RowType Gets the processed row’s type.
VisibleIndex Gets the visible index of the data row. Inherited from ASPxGridViewItemEventArgs.

The event data class exposes the following methods:

Method Description
GetValue(String) Returns the value of the specified cell within the processed row.


The HtmlRowPrepared event is raised for each grid row (data row, group row, etc.) within the ASPxGridView. You can handle this event to change the style settings of individual rows.

The HtmlRowPrepared and ASPxGridView.HtmlRowCreated events are not fired for the grid’s column header row and title row. So, the ASPxGridViewTableRowEventArgs.RowType property is never set to GridViewRowType.Title or GridViewRowType.Header within these event arguments.


In this example, the HtmlRowPrepared event is handled to highlight the products whose price is less than $20 or more than $50.

The image below shows the result:

ASPxGreedView - HtmlRowPrepared

    protected void ASPxGridView1_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridViewTableRowEventArgs e) {
        if (e.RowType != GridViewRowType.Data) return;
        int price = Convert.ToInt32(e.GetValue("UnitPrice"));
        if (price < 20)
            e.Row.BackColor = System.Drawing.Color.LightCyan; 
        if (price > 50)
            e.Row.ForeColor = System.Drawing.Color.DarkRed;
See Also