[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Collapse]Binding to Data
     Binding to Data Overview
    [Expand]Data Source Configuration Wizard
    [Expand]OLAP Data Source
    [Expand]Database Server Mode
     Unbound Fields
     Optimized Mode and Data Binding API
     Local Data Stores
     Asynchronous Mode
   [Expand]Data Shaping
   [Expand]Data Analysis
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Design-Time Features
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Local Data Stores

Sometimes end-users need to work with PivotGridControl when no connection to the database exists. Whenever a connection to the database exists, an end-user can save the Pivot Grid Control's data to a file or stream. Then, when the connection isn't available, it is possible to load the saved data and continue working with the PivotGridControl.

Expanded Creating and Using Local Data Stores

The PivotGridControl.SavePivotGridToFile method saves Pivot Grid Control's current data to a file for later use (if required, you can save the data to a stream via the PivotGridControl.SavePivotGridToStream method). These methods save all the original data from the data store, together with the full layout, including appearance settings. It is possible to set the method's compress parameter to true to enable data compression. This will reduce the size of the resultant file, but may increase the time required for data saving/loading.

To load the saved data, a PivotFileDataSource object must be created and assigned to the PivotGridControl.DataSource property. This automatically restores the layout portion from the specified file and loads the saved data. After data has been restored, an end-user is able to manipulate the Pivot Grid Control's layout, sort and filter data, etc.


A PivotFileDataSource object can be created using the constructor that takes a System.IO.Stream object as a parameter. In this instance, do not dispose of the specified stream until the PivotFileDataSource object is assigned to the PivotGridControl.DataSource property.


Typically, you save and restore data in the same control. However, it is possible to restore the saved data in another PivotGridControl. In this instance, custom logic implemented in the first Pivot Grid Control in code will not be available in the second control. For example, unbound fields that are populated via the PivotGridControl.CustomUnboundFieldData event will not provide any data in the second PivotGridControl.

Expanded Example

The following example shows how to save the Pivot Grid Control's data to a file, and then load it later.

To save the data the PivotGridControl.SavePivotGridToFile method is called. To restore the data, a PivotFileDataSource object is initialized and assigned to the PivotGridControl.DataSource property.

Is this topic helpful?​​​​​​​