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
 3090120 5595150270
 435093 187997190
 552479 24 24103
2778134239 12050170409
 25 25 10 1035
 792099 15621120
128549146 167120287433
 30 30 8735122152
 3043731003935174247
97491490107813054542010952173
525 30 60 6090
85839652023684683040882257717514021
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
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • style.css
<%@ Page Title="" Language="C#"  AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.PivotGrid.Examples.PersistingPivotGridSettings.DefaultCS" %>

<%@ 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