Skip to main content


  • 4 minutes to read

Pivot Grid Fields supply data toASPxPivotGrid. Fields are visualized with field headers which you can drag-and-drop between the Pivot Grid areas. Dragging fields between areas modifies the report layout.

To create a report in ASPxPivotGrid, create pivot grid fields and position them within the Pivot Grid areas.

You can place a field in one of four areas: Column, Row, Data, and Filter Header Area. The field’s function is determined by the area in which it is displayed:


  • position a field within the Column Header Area to list its values along the control’s top edge. These field’s values are column headers;
  • position a field within Row Header Area to list its values along the control’s left edge. These field’s values are row headers;
  • position a field within Data Header Area to calculate summaries against this fields. The summaries are calculated for all the cells; a specific column and row identifies each cell;
  • position a field within the Filter Header Area to make this field available for further customizations. For instance, you can drag it to a different area later. In addition, a user can use the filter drop-down to filter data against a filter field.

Binding Basics

ASPxPivotGrid uses the Binding API to bind Pivot Grid fields to data in OLAP, Server, and Optimized modes. You can use calculated expressions, data source columns, or window calculations as data binding sources.


This example demonstrates how to create an ASPxPivotGrid and bind it to data in code.

In this example, the ASPxPivotGrid and System.Web.UI.WebControls.AccessDataSource instances are created and initialized in code. Assign the AccessDataSource instance to the ASPxPivotGrid.DataSource property to bind the Pivot Grid to the created data source. Then call the ASPxPivotGrid.RetrieveFields method to generate DataSourceColumnBinding objects for each Pivot Grid field.

View Example

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

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

<html xmlns="" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server"/>
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxPivotGrid;
using DevExpress.XtraPivotGrid;
using System.Linq;

namespace ASPxPivotGrid_RuntimeDataBinding {
    public partial class _Default : Page {
        //private AccessDataSource ds;
        private SqlDataSource ds;
        private ASPxPivotGrid ASPxPivotGrid1;
        protected override void OnLoad(EventArgs e) {

            // Initializes a data source.
            ds = new SqlDataSource("System.Data.OleDb","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\nwind.mdb",
                "SELECT [CategoryName], [ProductName], [ProductSales], [ShippedDate] FROM [ProductReports]");

            // Initializes ASPxPivotGrid.
            ASPxPivotGrid1 = new ASPxPivotGrid();
            ASPxPivotGrid1.OptionsData.DataProcessingEngine = PivotDataProcessingEngine.Optimized;

            // Binds ASPxPivotGrid to the data source.
            ASPxPivotGrid1.DataSource = ds;

            // Places the Pivot Grid onto a page.

            if (ASPxPivotGrid1.Fields.Count != 0) 

            // Creates Pivot Grid fields for all data source columns.

            // Locates the Pivot Grid fields in appropriate areas.
            ASPxPivotGrid1.Fields["CategoryName"].Area = PivotArea.RowArea;
            ASPxPivotGrid1.Fields["ProductName"].Area = PivotArea.RowArea;
            ASPxPivotGrid1.Fields["ShippedDate"].Area = PivotArea.ColumnArea;
            ASPxPivotGrid1.Fields["ProductSales"].Area = PivotArea.DataArea;
            (ASPxPivotGrid1.Fields["ShippedDate"].DataBinding as DataSourceColumnBinding).GroupInterval = PivotGroupInterval.DateYear;