ASPxGridViewTableDataCellEventArgs Class
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v18.2.dll
Declaration
public class ASPxGridViewTableDataCellEventArgs :
ASPxGridViewItemEventArgs
Public Class ASPxGridViewTableDataCellEventArgs
Inherits ASPxGridViewItemEventArgs
Example
In this example, the ASPxGridView.HtmlDataCellPrepared event is handled to highlight the Budget column’s cells whose values are less than 100,000.
The image below shows the result:
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;
}
Protected Sub ASPxGridView1_HtmlDataCellPrepared(ByVal sender As Object,_
ByVal e As DevExpress.Web.ASPxGridViewTableDataCellEventArgs)_
Handles ASPxGridView1.HtmlDataCellPrepared
If e.DataColumn.FieldName = "Budget" Then
If Convert.ToInt32(e.CellValue) < 100000 Then
e.Cell.BackColor = System.Drawing.Color.LightCyan
End If
End If
End Sub
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="DepartmentsDataSource" KeyFieldName="ID" OnHtmlDataCellPrepared="ASPxGridView1_HtmlDataCellPrepared">
<SettingsPager PageSize="7" />
<Columns>
<dx:GridViewDataTextColumn FieldName="DepartmentName" Caption="Department">
</dx:GridViewDataTextColumn>
<dx:GridViewDataSpinEditColumn FieldName="Budget">
<PropertiesSpinEdit DisplayFormatString="c0" />
</dx:GridViewDataSpinEditColumn>
<dx:GridViewDataTextColumn FieldName="Location">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Phone1" Caption="Phone">
</dx:GridViewDataTextColumn>
</Columns>
</dx:ASPxGridView>
See Also