Skip to main content

Binding to Data

  • 4 minutes to read

The PivotGridControl should be connected to an external data source that supplies data you wish to display and process. You can bind the Pivot Grid to various types of data sources (an SQL database, an OLAP cube, an object, etc.).

To display data within the Pivot Grid, you need to create Pivot Grid fields that are used to visualize data from specific data source fields.

Note

The Pivot Grid is not automatically updated when the data source is modified. You need to call the PivotGridControl.RefreshData or PivotGridControl.RefreshDataAsync() method that will forcibly reload the records in the data source.

Populate the Pivot Grid with Data

Bind the Pivot Grid to Data at Design Time

To bind PivotGridControl to data, click the control’s smart tag and select one of the following options:

  • The Data Source Wizard command, which allows you to invoke the Data Source Configuration Wizard used to create various types of data sources.

    GettingStarted_L1_InvokeDataSourceWizard

  • The Choose Data Source combo box, which allows you to select the existing project data source.

    If necessary, click Add Project Data Source… to create a new data source.

    ChooseDataSource_AddProjectDataSource

    This invokes the Data Source Configuration Wizard, which allows you to create and edit data sources in your application.

  • Choose OLAP Data Source, which allows you to connect to a cube in a Microsoft Analysis Services server. Refer to the Binding to OLAP Data Sources topic for more information.

Bind the Pivot Grid to Data in Code

PivotGridControl exposes the PivotGridControl.DataSource and PivotGridControl.DataMember properties used to specify the data source/data member for the Pivot Grid.

Use the PivotGridControl.DataMember property to bind a Pivot Grid to a data source (for example, a DataSet object) that contains several lists/tables. For this, set the PivotGridControl.DataSource property to the aggregated data source and set the PivotGridControl.DataMember property to the name that identifies the required table.

Note

The following topic lists typical data sources to which the data-aware DevExpress controls can be bound: Traditional Data Binding Methods.

Local Data Stores

Refer to the following article for information on how to to store the current Pivot Grid’s data to a file or stream when no connection to the database exists: Local Data Stores.

Supported Data Sources

Topics in this section describe how to bind the Pivot Grid to all available data source types.

Populate Pivot Grid Fields with Data

To visualize data in the Pivot Grid, create Pivot Grid fields, populate them with data from the connected data source, and position them in the header areas.

The technique of binding Pivot Grid fields to data depends on the data source to which the Pivot Grid is connected or data processing mode that the Pivot Grid uses to process data. The data processing mode determines how Pivot Grid executes data aggregation and filter operations. The following modes are available: In-Memory, Server, and OLAP modes.

Topics in the following sections describe how to create and bind Pivot Grid fields to data in different data processing modes:

Sever Mode
Shows how to connect the Pivot Grid to server mode data sources and populate Pivot Grid fields with data.
OLAP Mode
Describes how to connect the Pivot Grid to an OLAP data source and populate Pivot Grid fields with data.
In-Memory Mode
Describes how to populate Pivot Grid fields with data when Pivot Grid uses In-Memory mode.

Refer to the following topic for more information about data processing modes: Pivot Grid Data Processing Modes.