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
5836801743010 40214
 3090120205595170290
 435093 187997190
245524103 24 24127
2778134239 12050170409
 25 25 10 1035
 792099 15621120
228549156 167120287443
 30 30 8735122152
 3043731003935174247
131491490111215054542011152227
525 30 60 6090
928396520236916106040882257740514321
BeveragesChartreuse 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
Beverages Total
CondimentsGenen Shouyu
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