Binding to Data Overview
- 2 minutes to read
The PivotGridControl should be connected to an external data source that provides data you wish to display and process. You can bind a PivotGridControl to various types of data sources (an SQL database, an OLAP cube, an object, etc.).
To display data within the PivotGridControl, you need to create Pivot Grid fields that are used to visualize data from specific data source fields.
The PivotGridControl is not automatically updated when the data source is modified. You need to call the PivotGridControl.RefreshData method that will forcibly reload the records in the data source.
Bind a Pivot Grid to Data at Design Time
To bind the PivotGridControl to data, click its smart tag and select one of the following options.
- The Data Source Wizard command allows you to invoke the Data Source Configuration Wizard, which can be used to create various types of data sources.
The Choose Data Source combo box allows you to select the existing project data source.
If necessary, you can create a new data source using the Add Project Data Source… command.
This invokes the Data Source Configuration Wizard, which allows you to create and edit data sources in your application.
- Choose OLAP Data Source allows you to connect to a cube in a Microsoft Analysis Services server. To learn more, see OLAP Data Source.
Bind a Pivot Grid to Data in Code
The PivotGridControl exposes the PivotGridControl.DataSource and PivotGridControl.DataMember properties used to specify the data source/data member for the Pivot Grid. Note that the PivotGridControl.DataMember property is in effect when a data source (e.g., a DataSet object) contains several lists/tables. To bind the Pivot Grid to data in this case, set its PivotGridControl.DataSource property to the aggregated data source and set its PivotGridControl.DataMember property to the name that identifies the required table.
The following topic lists typical data sources to which the data-aware DevExpress controls can be bound: Traditional Data Binding Methods.