Back to Devexpress

How to: Specify Custom Display Text for Data Cells

aspnet-114349-components-card-view-examples-how-to-provide-custom-display-text-for-data-cells.md

latest637 B
Original Source

How to: Specify Custom Display Text for Data Cells

  • Nov 18, 2021

The following example displays the “empty” string within the Discount column’s cells if they contain zero values.

The image below shows the result:

csharp
protected void CardView_CustomColumnDisplayText(object sender, ASPxCardViewColumnDisplayTextEventArgs e) {
        if (e.Column.FieldName != "Discount") return;
        if (Convert.ToInt32(e.Value) == 0)
            e.DisplayText = "empty";
    }