CardViewSettings.CustomColumnDisplayText Property
Enables custom display text to be provided to any cell.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
ASPxCardViewColumnDisplayTextEventHandler | An ASPxCardViewColumnDisplayTextEventHandler delegate method allowing you to implement custom processing. |
Remarks
Use the CustomColumnDisplayText property to provide custom display text for any cell. This property is in effect both for bound and unbound columns. The card view uses the CustomColumnDisplayText property’s value when you print or export the card view.
Use the ASPxGridColumnDisplayTextEventArgs.DisplayText parameter to provide custom display text. To get the current cell value, use the ASPxGridColumnDisplayTextEventArgs.Value parameter.
Use the CustomColumnDisplayText property to provide custom display text for any cell in two cases.
- The control hierarchy is being built.
- A user filters or sorts a card view by display text (the GridDataColumnSettings.FilterMode or the ASPxGridBehaviorSettings.SortMode property is set to DisplayText). In this case, the card view’s card visible indexes are not identified. The ASPxGridColumnDisplayTextEventArgs.VisibleIndex argument property returns -1. Therefore, you cannot use the GetFieldValue(int visibleRowIndex, string fieldName) overload of the ASPxGridColumnDisplayTextEventArgs.GetFieldValue method to get the value of the non-processed row.
Note
The CustomColumnDisplayText property is not in effect for template columns.
Example
This example demonstrates how to display the “empty” string within the “Units On Order” column’s cells if they contain zero values.
@Html.DevExpress().CardView(
settings => {
settings.Name = "CardView";
settings.CustomColumnDisplayText = (sender, e) =>
{
if (e.Column.FieldName != "UnitsOnOrder") return;
if (Convert.ToInt32(e.Value) == 0)
e.DisplayText = "empty";
};
}).Bind(Model).GetHtml()