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

Filtering

    The demo shows how to filter images by name by typing in a search field using the filter feature of RadClientDataSource. The functionality is achieved by utilizing the filter expression from the Client-side API of the control.

    • DefaultCS.aspx
    • scripts.js
    • styles.css
    <%@ Page Language="C#" AutoEventWireup="true"  %>
    
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ 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 href="styles.css" rel="stylesheet" />
        <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
            <script type="text/javascript">
                //<![CDATA[
                var dataSource;
                var searchBox
                function pageLoad() {
                    searchBox = $get('<%=rtb1.ClientID%>');
                    dataSource = $find('<%= RadClientDataSource1.ClientID %>');
                    dataSource.fetch();
                }
                //]]>
            </script>
        </telerik:RadCodeBlock>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
        <div class="demo-containers">
            <div class="demo-container">
                <script type="text/javascript" src="scripts.js"></script>
                <telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
                    <DataSource>
                        <WebServiceDataSourceSettings ServiceType="OData">
                            <Select Url="https://demos.telerik.com/aspnet-ajax/Services/SampleODataService.svc/Products" />
                        </WebServiceDataSourceSettings>
                    </DataSource>
                    <ClientEvents OnChange="dataSourceChange" />
                </telerik:RadClientDataSource>
                <div class="demo-section">
                    <div class="searchBox">
                        <telerik:RadTextBox RenderMode="Lightweight" Skin="Silk" runat="server" ID="rtb1" EmptyMessage="Search by Product Name" onkeyup="filterKeyPress(event)" Width="100%"></telerik:RadTextBox>
                        <span class="searchIcon"></span>
                    </div>
                    <ul id="products"></ul>
                </div>
            </div>
        </div>
        </form>
    </body>
    </html>

    Support & Learning Resources

    Find Assistance