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

WebForms PersistenceFramework Overview

  • Continents
  • Oceans

Follow the steps in order to save/load the state of Telerik’s ASP.NET TreeView and ListBox controls:

  • Change the state of the controls by selecting (multiple selection is ON), checking and expanding nodes/items.
  • Save their state with the save button.
  • Reset the controls to their initial state.
  • Load the previously saved state.

About RadPersistenceFramework for ASP.NET AJAX

Telerik’s Persistence Framework provides the ability to preserve and restore the state of UI for ASP.NET AJAX, which gives your end users the freedom to arrange and use your app in a way most convenient to them. The framework mainly saves and loads settings of the Telerik controls which are UI configurable, e.g. RadTreeView’s expanded, checked and selected state. The core functionality is presented by RadPersisterManager and RadPersisterManagerProxy – there should be only one instance of the RadPersistenceManager and the proxies are defined on the content pages or user controls to persists the state of the controls on them. RadPersistenceManager allows you to save and load custom key-value settings.

RadPersistenceFramework and 120+ other controls are part of UI for ASP.NET AJAX, a comprehensive toolset taking care of the common functionality of your application, while leaving you with more time to work on its business logic.

Key Features

  • Persistence of Telerik controls state
  • Persistence of custom key-value settings
  • Ability to implement own storage and serialization providers

More about RadPersistenceFramework for ASP.NET AJAX
  • DefaultCS.aspx
  • Info.ascx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="DefaultCS" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!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="styles.css" />
</head>

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container">
        <asp:HiddenField runat="server" ID="SessionID" />
        <telerik:RadPersistenceManager runat="server" ID="RadPersistenceManager1">
            <PersistenceSettings>
                <telerik:PersistenceSetting ControlID="RadTreeView1" />
                <telerik:PersistenceSetting ControlID="RadListBox1" />
            </PersistenceSettings>
        </telerik:RadPersistenceManager>
        <asp:Label ID="Label1" runat="server" />
        <div class="qsf-ib">
            <telerik:RadButton RenderMode="Lightweight" ID="SaveButton" runat="server" Text="Save state" OnClick="SaveButton_Click" Skin="Office2007" />
            <telerik:RadButton RenderMode="Lightweight" ID="ResetButton" runat="server" Text="Reset state" OnClick="ResetButton_Click" Skin="Office2007" />
            <telerik:RadButton RenderMode="Lightweight" ID="LoadButton" runat="server" Text="Load state" OnClick="LoadButton_Click" Enabled="false" Skin="Office2007" />
        </div>
        <div class="controls-container">
            <telerik:RadListBox RenderMode="Lightweight" runat="server" ID="RadListBox1" CheckBoxes="true" SelectionMode="Multiple" Skin="Office2007">
                <Items>
                    <telerik:RadListBoxItem Text="Australia"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="Brazil"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="Canada"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="Chile"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="China"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="Egypt"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="Germany"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="Indonesia"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="Kenya"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="Mexico"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="New Zealand"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="South Africa"></telerik:RadListBoxItem>
                    <telerik:RadListBoxItem Text="USA"></telerik:RadListBoxItem>
                </Items>
            </telerik:RadListBox>
        </div>
        <div class="controls-container">
            <telerik:RadTreeView RenderMode="Lightweight" runat="server" ID="RadTreeView1" MultipleSelect="true" CheckBoxes="true" Skin="Office2007">
            </telerik:RadTreeView>
        </div>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance