Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Collapse]Binding to Data
     Binding to Data Overview
    [Expand]Data Source Configuration Wizard
    [Expand]OLAP Data Source
    [Expand]Database Server Mode
     Unbound Fields
     Local Data Stores
     Asynchronous Mode
   [Expand]Data Shaping
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Appearance
   [Expand]Design-time Features
   [Expand]Miscellaneous
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Examples
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap 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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

Note

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.

Note

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.

How would you rate this topic?​​​​​​​