New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Persisting PivotGrid Settings

All Fields
ShipCountryYearCategoryNameProductNameQuantityProductID
Filter Fields
Column Fields
Aggregate Fields
Quantity
empty
QuantityShipCountryYear
CategoryNameProductName
GermanyGermany Total USAUSA TotalGrand Total
199619971998199619971998
607040170385137180350
241308123525130139294529
5836801743010242216
 3090120205595170290
 435093 187997190
2455241031524 39142
7578134287 12050170457
525 30 10 1040
217920120 15621141
2285491566167124297453
 30 30 8735122152
10030431731003935174347
1910475625479213153946393152933018543
BeveragesChai
Chang
Chartreuse verte
Côte de Blaye
Guaraná Fantástica
Ipoh Coffee
Lakkalikööri
Laughing Lumberjack Lager
Outback Lager
Rhönbräu Klosterbier
Sasquatch Ale
Steeleye Stout
Grand Total
Page size:
  • Stacked
  • Side-By-Side
  • Two-By-Two
  • One-By-Four
  • Move Up
  • Move Down
  • Move to Beginning
  • Move to End
  • Move to Filter Fields
  • Move to Row Fields
  • Move to Column Fields
  • Move to Aggregate Fields
  • Hide Field
  • Summarize By Settings

The example demonstrates how you could save and restore different setting of RadPivotGrid.

Using the Persistence Framework, you can save/restore pivot grid settings like:

  • Aggregates position
  • Aggregates level
  • Page size
  • Collapsed row indexes
  • Collapsed column indexes
  • Sort expressions
  • Configuration panel - layout type
  • Fields collection
    • Sort order
    • Zone index
    • Unique name
    • Zone type
  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • style.css
<%@ Page Title="" Language="VB"  AutoEventWireup="false" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.PivotGrid.Examples.PersistingPivotGridSettings.DefaultVB" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
  <telerik:RadPersistenceManager runat="server" ID="RadPersistenceManager1">
        <PersistenceSettings>
            <telerik:PersistenceSetting ControlID="RadPivotGrid1" />
        </PersistenceSettings>
    </telerik:RadPersistenceManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
    <div class="demo-container">
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
            <div class="demo-settings">
                <telerik:RadButton RenderMode="Lightweight" ID="SaveButton" runat="server" Text="Save state" OnClick="SaveButton_Click" />
                <telerik:RadButton RenderMode="Lightweight" ID="ResetButton" runat="server" Text="Reset stored state" OnClick="ResetButton_Click" />
                <telerik:RadButton RenderMode="Lightweight" ID="LoadButton" runat="server" Text="Load state" OnClick="LoadButton_Click" />
            </div>
            <telerik:RadPivotGrid RenderMode="Lightweight" ID="RadPivotGrid1" runat="server" DataSourceID="SqlDataSource1" AllowFiltering="true"
                AllowPaging="true" PageSize="12" ShowFilterHeaderZone="false" AllowSorting="true" EnableConfigurationPanel="true">
                <Fields>
                    <telerik:PivotGridColumnField DataField="ShipCountry">
                    </telerik:PivotGridColumnField>
                    <telerik:PivotGridColumnField DataField="Year">
                    </telerik:PivotGridColumnField>
                    <telerik:PivotGridRowField DataField="CategoryName">
                    </telerik:PivotGridRowField>
                    <telerik:PivotGridRowField DataField="ProductName">
                    </telerik:PivotGridRowField>
                    <telerik:PivotGridAggregateField DataField="Quantity" Aggregate="Sum">
                    </telerik:PivotGridAggregateField>
                </Fields>
                <ConfigurationPanelSettings Position="Left" DefaultDeferedLayoutUpdate="true" />
            </telerik:RadPivotGrid>
        </telerik:RadAjaxPanel>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="SELECT [ProductID], [ProductName], [ShipCountry], [CategoryName], [Year], [Quantity] FROM [Product Reports Comparison]"
        runat="server"></asp:SqlDataSource>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance