Log In
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]HTML Editor
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Data Shaping
   [Expand]Data Analysis
   [Collapse]Data Formatting
     Formatting Summaries and Field Values
     Formatting via Events
   [Expand]Data Export
   [Expand]Design-Time Features
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Formatting via Events

The Pivot Grid allows custom text to be displayed within individual data cells. To do this, handle the ASPxPivotGrid.CustomCellDisplayText event. This event is fired for each cell in bound and unbound fields.

Each data cell displays a summary value calculated against Data Field. This data field is returned by the event parameter's PivotCellEventArgsBase<TField, TData, TCustomTotal>.DataField property. The cell's current value is returned by the event parameter's PivotCellEventArgsBase<TField, TData, TCustomTotal>.Value property.

To change the cell's display text, use the PivotCellDisplayTextEventArgs.DisplayText property. Initially, this property contains the text currently displayed within a cell. To provide a custom text, assign it to the PivotCellDisplayTextEventArgs.DisplayText property.

Expanded Example: How to Format Cells via Events

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1893.

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.

How would you rate this topic?​​​​​​​