Skip to main content

How to: Specify Custom Display Text for Data Cells

This example demonstrates how to display the “empty” string within the Units On Order column’s cells if they contain zero values.

The image below shows the result:

CustomColumnDisplayText

protected void ASPxGridView2_CustomColumnDisplayText(object sender,
    DevExpress.Web.ASPxGridViewColumnDisplayTextEventArgs e) {
    if (e.Column.FieldName != "UnitsOnOrder") return;
    if (Convert.ToInt32(e.Value) == 0)
        e.DisplayText = "empty";
}