How to: Change the Style Settings of Individual Data Cells
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: