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

Persisting ComboBox Settings

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

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Title="" Language="C#"  AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="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" 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 size-narrow">
        <div class="demo-settings">
            <telerik:RadPersistenceManager runat="server" ID="RadPersistenceManager1">
                <PersistenceSettings>
                    <telerik:PersistenceSetting ControlID="RadComboBox1" />
                    <telerik:PersistenceSetting ControlID="RadComboBox2" />
                </PersistenceSettings>
            </telerik:RadPersistenceManager>
            <asp:Label ID="Label1" runat="server"></asp:Label>
            <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:RadComboBox RenderMode="Lightweight" runat="server" ID="RadComboBox1" Width="245px" >
            <Items>
                <telerik:RadComboBoxItem Text="Asia" Value="" />
                <telerik:RadComboBoxItem Text="Australia" Value="" />
                <telerik:RadComboBoxItem Text="Africa" Value="" />
                <telerik:RadComboBoxItem Text="Europe" Value="" />
                <telerik:RadComboBoxItem Text="South America" Value="" />
                <telerik:RadComboBoxItem Text="North America" Value="" />
                <telerik:RadComboBoxItem Text="Antarctica" Value="" />
            </Items>
        </telerik:RadComboBox>
        <telerik:RadComboBox RenderMode="Lightweight" runat="server" ID="RadComboBox2" CheckBoxes="true" EnableCheckAllItemsCheckBox="true" Width="250px" >
            <Items>
                <telerik:RadComboBoxItem Text="Asia" Value="" />
                <telerik:RadComboBoxItem Text="Australia" Value="" />
                <telerik:RadComboBoxItem Text="Africa" Value="" />
                <telerik:RadComboBoxItem Text="Europe" Value="" />
                <telerik:RadComboBoxItem Text="South America" Value="" />
                <telerik:RadComboBoxItem Text="North America" Value="" />
                <telerik:RadComboBoxItem Text="Antarctica" Value="" />
            </Items>
        </telerik:RadComboBox>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance