ASPxPivotGrid.CustomCellDisplayText Event

Enables custom display text to be provided for cells displayed within the Data Area.

Namespace: DevExpress.Web.ASPxPivotGrid

Assembly: DevExpress.Web.ASPxPivotGrid.v19.2.dll


public event PivotCellDisplayTextEventHandler CustomCellDisplayText
Public Event CustomCellDisplayText As PivotCellDisplayTextEventHandler

Event Data

The CustomCellDisplayText event handler receives an argument of the PivotCellDisplayTextEventArgs type. The following properties provide information specific to this event.

Property Description
CellItem For internal use.
(Inherited from PivotCellBaseEventArgs)
ColumnCustomTotal Gets the column custom total which displays the current cell.
ColumnField Gets the innermost column field which corresponds to the processed cell.
ColumnFieldIndex For internal use.
ColumnIndex Gets the visual index of the column that contains the processed cell.
ColumnValueType Gets the type of column which contains the processed cell.
Data For internal use.
DataField Gets the data field which identifies the column where the processed cell resides.
DisplayText Gets or sets the display text for the cell currently being processed.
Item For internal use.
RowCustomTotal Gets the row custom total which contains the current cell.
RowField Gets the innermost row field which corresponds to the processed cell.
RowFieldIndex For internal use.
RowIndex Gets the index of the row that contains the processed cell.
RowValueType Gets the type of row which contains the processed cell.
SummaryType Gets the summary type of the currently processed value.
SummaryValue Gets the summary value currently being processed.
Value Gets the processed cell's value.


The CustomCellDisplayText event allows customizing the text within data cells. A data cell displays a summary value calculated against a specific Data Field. This field is identified by the event parameter's PivotCellEventArgsBase<TField, TData, TCustomTotal>.DataField property. The current value and its formatted text representation are specified by the event's PivotCellEventArgsBase<TField, TData, TCustomTotal>.Value and PivotCellDisplayTextEventArgs.DisplayText properties.

Data cell format settings can be specified via the PivotGridFieldBase.CellFormat, PivotGridFieldBase.GrandTotalCellFormat and PivotGridFieldBase.TotalCellFormat properties.

Use the ASPxPivotGrid.FieldValueDisplayText event or the PivotGridFieldBase.ValueFormat property to customize display text used to represent field values.


The following example shows how to provide custom text for the ASPxPivotGrid's cells by handling the ASPxPivotGrid.CustomCellDisplayText event.

In this example, if a Grand Total value is less than 50 000, ASPxPivotGrid displays the Low value instead. If the value exceeds 100 000, High is displayed; otherwise, Middle.

using System;
using System.Web.UI;
using DevExpress.Web.ASPxPivotGrid;
using DevExpress.XtraPivotGrid;

namespace FormattingViaEvents {
    public partial class _Default : Page {
        protected void Page_Load(object sender, EventArgs e) {
        protected void CustomCellDisplayText(object sender, PivotCellDisplayTextEventArgs e) {
            if (e.RowValueType != PivotGridValueType.GrandTotal ||
                e.ColumnValueType == PivotGridValueType.GrandTotal) return;
            if (Convert.ToSingle(e.Value) < 50000)
                e.DisplayText = "Low";
            else if (Convert.ToSingle(e.Value) > 100000)
                e.DisplayText = "High";
                e.DisplayText = "Middle";
See Also