Skip to main content
Tab

ASPxGridViewTableDataCellEventArgs Class

Provides data for the ASPxGridView.HtmlDataCellPrepared event.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public class ASPxGridViewTableDataCellEventArgs :
    ASPxGridViewItemEventArgs

Example

This example handles the ASPxGridView.HtmlDataCellPrepared event to highlight the Budget column’s cells whose values are less than 100,000.

<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" KeyFieldName="ID"
    OnHtmlDataCellPrepared="ASPxGridView1_HtmlDataCellPrepared">
    <Columns>
        <dx:GridViewDataTextColumn FieldName="DepartmentName" Caption="Department" />
        <dx:GridViewDataSpinEditColumn FieldName="Budget">
            <PropertiesSpinEdit DisplayFormatString="c0" />
        </dx:GridViewDataSpinEditColumn>
        <dx:GridViewDataTextColumn FieldName="Location" />
        <dx:GridViewDataTextColumn FieldName="Phone1" Caption="Phone" />
    </Columns>
</dx:ASPxGridView>
protected void ASPxGridView1_HtmlDataCellPrepared(object sender,
    DevExpress.Web.ASPxGridViewTableDataCellEventArgs e) {
    if(e.DataColumn.FieldName != "Budget")
        return;
    if(Convert.ToInt32(e.CellValue) < 100000)
        e.Cell.BackColor = System.Drawing.Color.LightCyan;
}

The image below shows the result:

HtmlDataCellPrepared

See Also