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

Persisting ListBox Settings

In this example you can see how to preserve the Selected and Checked nodes of RadListBox control using the Telerik ASP.NET Persistence Framework.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • styles.css
<%@ Page Title="" Language="VB"  AutoEventWireup="false" CodeFile="DefaultVB.aspx.vb" Inherits="DefaultVB" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link rel="stylesheet" href="styles.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="RadListBox1" />
        </PersistenceSettings>
    </telerik:RadPersistenceManager>

    <div class="demo-container">

        <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 state" OnClick="ResetButton_Click" />
            <telerik:RadButton RenderMode="Lightweight" ID="LoadButton" runat="server" Text="Load state" OnClick="LoadButton_Click" />
        </div>

        <telerik:RadListBox RenderMode="Lightweight" ID="RadListBox1" runat="server" CheckBoxes="true" ShowCheckAll="true" Width="300px" Height="300px">
            <Items>
                <telerik:RadListBoxItem Text="Arts" />
                <telerik:RadListBoxItem Text="Biographies" />
                <telerik:RadListBoxItem Text="Children's Books" />
                <telerik:RadListBoxItem Text="Computers &amp; Internet" />
                <telerik:RadListBoxItem Text="Cooking" />
                <telerik:RadListBoxItem Text="History" />
                <telerik:RadListBoxItem Text="Fiction" />
                <telerik:RadListBoxItem Text="Mystery" />
                <telerik:RadListBoxItem Text="Nonfiction" />
                <telerik:RadListBoxItem Text="Romance" />
                <telerik:RadListBoxItem Text="Science Fiction" />
                <telerik:RadListBoxItem Text="Travel" />
            </Items>
        </telerik:RadListBox>
    </div>

    </form>
</body>
</html>

Support & Learning Resources

Find Assistance