The following example demonstrates how to save the layout from the one Pivot Grid and apply it to another Pivot Grid.
The Pivot Grid layout determines the position and appearance of its visual elements. You can customize and save the current Pivot Grid control's layout and apply the same settings to other Pivot Grid controls.
The old Pivot Grid contains the "Year" and "Quarter" fields that do not exist in the new Pivot Grid. The new Pivot Grid contains the "Country" and "Sales Person" fields that do not exist in the old Pivot Grid. When you apply the saved layout to the new Pivot Grid control, the "Year" and "Quarter" fields from the saved layout replace the "Country" and "Sales Person" fields. This behavior is set by the RemoveOldColumns and AddNewColumns properties. In this example, the RemoveOldColumns and AddNewColumns properties are set to false. As a result, the Pivot Grid restores the fields that exist in the saved layout, and leaves fields that exist both in the Pivot Grid and in the saved layout with the same Name values.
The LayoutVersion property is defined for two Pivot Grid controls. When you click the "Restore layout" button (and the saved layout is restored from a data store), the LayoutUpgrade event is raised since the layout versions are different. As a result, a new "Quantity" field is added to the new Pivot Grid control.
The Pivot Grid uses a field's Name property value to determine fields in a stored layout.
ASPxPivotGrid.SaveLayoutToStream
Saves the Pivot Grid layout to the specified stream.
ASPxPivotGrid.LoadLayoutFromStream
Restores the Pivot Grid layout from the specified stream.
OptionsColumnLayout.StoreAppearance
Gets or sets whether the appearance settings of the columns and bands are also stored when the layout is saved to storage and restored when the layout is restored from storage. In this example, stores the caption of the "Year" and "Quarter" fields.
OptionsColumnLayout.AddNewColumns, OptionsColumnLayout.RemoveOldColumns
New columns are fields in the control, old columns are fields in the saved layout.
If old and new fields have the same ID, the control applies the saved layout changes to the fields in the control.
If old and new fields have a different ID, then the following behavior occurs:
If both properties are true, the Pivot Grid removes fields from the saved layout and allows the fields in the control to remain there.
If both properties are false, Pivot Grid restores fields from the layout and removes fields from the control.
If AddNewColumns is true and RemoveOldColumns is false, Pivot Grid restores fields from the layout and leaves fields in the control to remain there.
If AddNewColumns is false and RemoveOldColumns is true, Pivot Grid removes fields both from the layout and control.
ASPxPivotGrid.LayoutUpgrade
Occurs when a layout is restored from a data store, and its version differs from the control's current layout version. Use the LayoutVersion property to assign the version of the layout and enable the LayoutUpgrade event.
(you will be redirected to DevExpress.com to submit your response)