Obtaining Underlying Data (Drill-Down)

  • 5 minutes to read

Cells display summaries calculated against data field(s) for a subset of the records in the Pivot Grid‘s data source. All records from this subset have matching values in a column field(s) and row field(s). These values are identified by column and row headers.

CreateDrillDownDataSource

To get the underlying records for an indivisual cell, use the ASPxPivotGrid.CreateDrillDownDataSource method.

Consider the following ASPxPivotGrid control:

ObtainUnderlyingData

For the top-leftmost cell ($1,500.00), the ASPxPivotGrid.CreateDrillDownDataSource method will return the records from the data source which have:

  • the value “Bon app’” in the ‘Customer’ field
  • the value “Carnarvon Tigers” in the ‘Product Name’ field
  • the 1995 value in the ‘Year’ field

For the cell ($2,435.00) at the intersection of the first column and fourth row, the ASPxPivotGrid.CreateDrillDownDataSource method will return the records which have:

  • the value “Bon app’” in the ‘Customer’ field
  • the 1995 value in the ‘Year’ field

Example: How to Obtain Underlying Data

The ASPxPivotGrid includes the drill-down capability, which enables you to retrieve a list of records that were used to calculate a particular summary.To obtain drill-down data, use the pivot grid's CreateDrillDownDataSource method. Its parameters completely identify a summary cell.In this example, an end-user can view records from the control's underlying data source, associated with a summary cell, by clicking on it. The obtained data is displayed by the ASPxGridView within a popup window.

View Example

using System;
using DevExpress.Web.ASPxGridView;

namespace DisplayUnderlyingRecords {
    public partial class _Default : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            string columnIndexValue = ColumnIndex.Value,
                      rowIndexValue = RowIndex.Value;            
            if (ASPxGridView1.IsCallback && 
                !string.IsNullOrEmpty(columnIndexValue) && !string.IsNullOrEmpty(rowIndexValue))
            {
                BindGridView(columnIndexValue, rowIndexValue);                
                ASPxGridView1.JSProperties.Add("cpShowDrillDownWindow", false);
            }
        }
        protected void ASPxGridView1_CustomCallback(object sender, 
            ASPxGridViewCustomCallbackEventArgs e) {
            if (e.Parameters == "D")
            {
                ASPxGridView1.PageIndex = 0;
                ASPxGridView1.JSProperties["cpShowDrillDownWindow"] = true;
            }
        }
        protected void BindGridView(string columnIndex, string rowIndex) {
            ASPxGridView1.DataSource = 
                ASPxPivotGrid1.CreateDrillDownDataSource(Int32.Parse(columnIndex), 
                                                         Int32.Parse(rowIndex));
            ASPxGridView1.DataBind();
        }

    }
}