ASPxGridView.HtmlRowPrepared Event
Enables the settings of individual rows to be changed.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
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 |
---|---|
Key |
Gets an object that uniquely identifies the row. |
Row | Gets the processed row. |
Row |
Gets the processed row’s type. |
Visible |
Gets the visible index of the data row.
Inherited from ASPx |
The event data class exposes the following methods:
Method | Description |
---|---|
Get |
Returns the value of the specified cell within the processed row. |
#Remarks
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.
Note
During export operations, the Grid View control ignores appearance settings specified in the Html
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.
#GitHub Examples
#Example
In this example, the HtmlRowPrepared event is handled to highlight the products whose price is less than $20 or more than $50.
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;
}