aspnet-devexpress-dot-web-30e26143.md
Provides data for the ASPxGridView.HtmlDataCellPrepared event.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public class ASPxGridViewTableDataCellEventArgs :
ASPxGridViewItemEventArgs
Public Class ASPxGridViewTableDataCellEventArgs
Inherits ASPxGridViewItemEventArgs
ASPxGridViewTableDataCellEventArgs is the data class for the following events:
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;
}
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
The image below shows the result:
Object EventArgs ASPxGridItemEventArgs ASPxGridViewItemEventArgs ASPxGridViewTableDataCellEventArgs BootstrapGridViewTableDataCellEventArgs
See Also