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

Save/Load RadFilter expressions

  • And
  • Or
  • Not And
  • Not Or
  • Contains
  • DoesNotContain
  • StartsWith
  • EndsWith
  • EqualTo
  • NotEqualTo
  • GreaterThan
  • LessThan
  • GreaterThanOrEqualTo
  • LessThanOrEqualTo
  • Between
  • NotBetween
  • IsEmpty
  • NotIsEmpty
  • IsNull
  • NotIsNull
  • OrderID
  • OrderDate
  • ShipCity
  • ShipCountry
  • ShipName

OrderIDOrderDateShipCityShipCountryShipName
Page size:
 762 items in 77 pages
103079/17/1996 12:00:00 AMPortlandUSALonesome Pine Restaurant
103149/25/1996 12:00:00 AM italyRattlesnake Canyon Grocery
103159/26/1996 12:00:00 AMCowesUKIsland Trading
103179/30/1996 12:00:00 AMPortlandUSALonesome Pine Restaurant
1031910/2/1996 12:00:00 AMMéxico D.F.MexicoTortuga Restaurante
1032110/3/1996 12:00:00 AMCowesUKIsland Trading
1032310/7/1996 12:00:00 AMBrandenburgGermanyKöniglich Essen
1032410/8/1996 12:00:00 AMBoiseUSASave-a-lot Markets
1032510/9/1996 12:00:00 AMBrandenburgGermanyKöniglich Essen
1032610/10/1996 12:00:00 AMMadridSpainBólido Comidas preparadas

This example demonstrates how to save/load RadFilter expressions by user. RadFilter public API offers two methods to achieve this functionality:

  • SaveSettings: Serialize the control expressions to Base64 encoded string.
  • LoadSettings: Loads the provided state in the control. The parameter for this method must be Base64 encoded string representing saved control expressions.
  • Load last settings on initial load: Loads the last set settings if you navigate away from the page and the come back.
  • DefaultVB.aspx
  • DefaultVB.aspx.vb
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.FilterExamplesVB.SaveLoadExpressions.DefaultVB"  %>

<%@ 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>
    <style type="text/css">
        div.container
        {
            margin-bottom: 20px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="CheckBoxes" />
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="LoadingPanel1" CssClass="demo-container">
        <div class="container">
            <telerik:RadPushButton Text="Save Settings" runat="server" ID="SaveSettings"></telerik:RadPushButton>
            <telerik:RadPushButton Text="Load Settings" runat="server" ID="LoadSettings"></telerik:RadPushButton>
            <asp:CheckBox runat="server" ID="CheckBox1" AutoPostBack="true" Text="Load last settings on initial load" />
        </div>
        <telerik:RadFilter RenderMode="Lightweight" runat="server" ID="RadFilter1" FilterContainerID="RadGrid1">
        </telerik:RadFilter>
        <br />
        <telerik:RadGrid RenderMode="Lightweight" runat="server" ID="RadGrid1" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" DataSourceID="SqlDataSource1">
            <MasterTableView>
                <Columns>
                    <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID" DataType="System.Int32">
                    </telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="OrderDate" HeaderText="OrderDate">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ShipCountry" HeaderText="ShipCountry">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ShipName" HeaderText="ShipName">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </telerik:RadAjaxPanel>
    <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1">
    </telerik:RadAjaxLoadingPanel>
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="Select OrderID, OrderDate, ShipVia, ShipName, ShipAddress, ShipCity, ShipCountry FROM Orders"></asp:SqlDataSource>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance