Skip to main content
A newer version of this page is available. .

PivotHtmlFieldValuePreparedEventArgs.Cell Property

Gets the processed data cell.

Namespace: DevExpress.Web.ASPxPivotGrid

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

Declaration

public TableCell Cell { get; }

Property Value

Type Description
TableCell

A TableCell object that represents the processed data cell.

Example

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.

asp-pivot-field-value-prepared

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

<%@ Register Assembly="DevExpress.Web.ASPxPivotGrid.v17.1, Version=17.1.4.0,
           Culture=neutral, PublicKeyToken=b88d1754d700e49a"
           Namespace="DevExpress.Web.ASPxPivotGrid"
           TagPrefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <dx:ASPxPivotGrid ID="ASPxPivotGrid1" runat="server" 
            DataSourceID="AccessDataSource1" Theme="Metropolis"
            onhtmlfieldvalueprepared="ASPxPivotGrid1_HtmlFieldValuePrepared">
            <Fields>
                <dx:PivotGridField ID="fieldCountry" Area="RowArea"
                    AreaIndex="0" FieldName="Country">
                </dx:PivotGridField>
                <dx:PivotGridField ID="fieldYear" Area="ColumnArea"
                    AreaIndex="0" FieldName="Year">
                </dx:PivotGridField>
                <dx:PivotGridField ID="fieldTotal" Area="DataArea"
                    AreaIndex="0" FieldName="Total">
                </dx:PivotGridField>
            </Fields>
        </dx:ASPxPivotGrid>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/nwind.mdb" 
            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')));
">
        </asp:AccessDataSource>
    </div>
    </form>
</body>
</html>
See Also