Save and Load Layout

RadPivotGrid supports save and load layout functionality, which gives your applications the opportunity to preserve user RadPivotGrid settings such as group descriptors and restore them later. Those layout settings are written in a xml file.

Here is a sample demonstrating how you can implement a Save Layout button event handler.

Telerik UI for WinForms Ninja image

The Save and Load Layout is part of Telerik UI for WinForms, a professional grade UI library with 160+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.

SaveLayout


private void radButtonSaveLayout_Click(object sender, EventArgs e)
{
    string s = "default.xml";
    SaveFileDialog dialog = new SaveFileDialog();
    dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
    dialog.Title = "Select a xml file";
    if (dialog.ShowDialog() == DialogResult.OK)
    {
        s = dialog.FileName;
    }
    this.radPivotGrid1.SaveLayout(s); 
}

Private Sub RadButtonSaveLayout_Click(sender As Object, e As EventArgs) Handles RadButtonSaveLayout.Click
    Dim s As String = "default.xml"
    Dim dialog As New SaveFileDialog()
    dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"
    dialog.Title = "Select a xml file"
    If dialog.ShowDialog() = DialogResult.OK Then
        s = dialog.FileName
    End If
    Me.RadPivotGrid1.SaveLayout(s)
End Sub

The code snippet below demonstrates how you can implement a Load Layout button event handler.

LoadLayout


private void radButtonLoadLayout_Click(object sender, EventArgs e)
{
    string s = "default.xml";
    OpenFileDialog dialog = new OpenFileDialog();
    dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
    dialog.Title = "Select a xml file";
    if (dialog.ShowDialog() == DialogResult.OK)
    {
        s = dialog.FileName;
    }
    this.radPivotGrid1.LoadLayout(s);
}

Private Sub RadButtonLoadLayout_Click(sender As Object, e As EventArgs) Handles RadButtonLoadLayout.Click
    Dim s As String = "default.xml"
    Dim dialog As New OpenFileDialog()
    dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"
    dialog.Title = "Select a xml file"
    If dialog.ShowDialog() = DialogResult.OK Then
        s = dialog.FileName
    End If
    Me.RadPivotGrid1.LoadLayout(s)
End Sub

This API should be used only if the data binding has been performed via the DataSource property or using a LocalSourceDataProvider. The API also does not export custom aggregate functions. For SAAS cubes and custom aggregation serialization please refer to:

See Also

In this article