The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxPivotGrid.HtmlFieldValuePrepared Event

Enables the settings of individual field value cells to be changed.

Namespace: DevExpress.Web.ASPxPivotGrid

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


public event PivotHtmlFieldValuePreparedEventHandler HtmlFieldValuePrepared
Public Event HtmlFieldValuePrepared As PivotHtmlFieldValuePreparedEventHandler

Event Data

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

Property Description
Cell Gets the processed data cell.
CustomTotal Gets the custom total that corresponds to the currently processed column/row header.
Data For internal use.
DataField Gets the data field that specifies the processed value.
Field Gets the field being processed.
(Inherited from PivotFieldEventArgsBase<T>)
FieldIndex Gets the field position among the visible fields within the header area.
FieldValueItem Gets the information about the field value currently being processed.
(Inherited from PivotFieldValueEventArgs)
IsCollapsed Gets whether the processed field value is collapsed.
IsColumn Gets whether the field is displayed within the Column Header Area.
IsOthersValue Gets or sets whether the current header corresponds to the "Others" row/column.
Item For internal use.
MaxIndex Gets the maximum row index (for row fields) or column index (for column fields) that corresponds to the processed field value.
MinIndex Gets the minimum row index (for row fields) or column index (for column fields) that corresponds to the processed field value.
Value Gets the column field or row field value that corresponds to the currently processed column/row header.
ValueType Gets the type of the currently processed header of a column or a row.


The HtmlFieldValuePrepared event is raised for each field value cell within the ASPxPivotGrid when the corresponding table cell has been created. You can handle this event to change the style settings of individual cells.

The processed cell is identified by the event parameter's PivotHtmlFieldValuePreparedEventArgs.Cell property.


This example demonstrates how to use the ASPxPivotGrid.HtmlFieldValuePrepared event to customize the appearance of a specific Field Value.

  • If the Country field value is equal to 'Brazil', the background color is set to LightGreen.
  • If the Country field value is equal to 'Argentina', the background color is set to LightBlue.
  • In other cases, the background color of the Country field values is set to LightYellow.

The image below shows the result.


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
           Inherits="FormatCellValues._Default" %>

<%@ Register Assembly="DevExpress.Web.ASPxPivotGrid.v__, Version=__,
           Culture=neutral, PublicKeyToken=b88d1754d700e49a"
           TagPrefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

<html xmlns="" >
<head runat="server">
    <form id="form1" runat="server">
        <dx:ASPxPivotGrid ID="ASPxPivotGrid1" runat="server" 
            DataSourceID="AccessDataSource1" Theme="Metropolis"
                <dx:PivotGridField ID="fieldCountry" Area="RowArea"
                    AreaIndex="0" FieldName="Country">
                <dx:PivotGridField ID="fieldYear" Area="ColumnArea"
                    AreaIndex="0" FieldName="Year">
                <dx:PivotGridField ID="fieldTotal" Area="DataArea"
                    AreaIndex="0" FieldName="Total">
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            SelectCommand="SELECT Customers.Country, Year([OrderDate]) AS [Year], Sum([UnitPrice]*[Quantity]) AS Total
FROM (Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID) INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID
GROUP BY Customers.Country, Year([OrderDate])
HAVING (((Customers.Country) In ('Brazil','Argentina','Germany','USA', 'UK')));
See Also