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

Filtering with RadFilter

  • And
  • Or
  • Not And
  • Not Or
  • Contains
  • DoesNotContain
  • StartsWith
  • EndsWith
  • EqualTo
  • NotEqualTo
  • GreaterThan
  • LessThan
  • GreaterThanOrEqualTo
  • LessThanOrEqualTo
  • Between
  • NotBetween
  • IsEmpty
  • NotIsEmpty
  • IsNull
  • NotIsNull
  • Title
  • Category Id
  • Parent Id


CategoryIdTitleParentId
12
Page size:
1Products 
 2UI for ASP.NET Ajax1
   3Overview2
  4Included Controls2
   23Why Choose2
   24What's New2
   25System Requirements2
   26Online Demos2
   27Release History2
   28RoadMap2
   29Documentation2
   30Testimonials2
   31Download Trial2
   32Buy Now2
 33UI for WinForms1
 57Reporting1
  171Test Studio1
132Purchase 
141Support 
155Community 

This demo illustrates how to filter RadTreeList bound to LinqDataSource using a RadFilter control.

For this purpose you need to handle the ApplyExpressions event and built up the sql query manually. There you should make sure the parent items to the root for the items fulfilling the filter criterion are returned as well. Otherwise, the filtered data set might have no any root items and as a result no records will be displayed.

The query used in this demo is universal and you can use it by replacing the columns' and the datatable's name.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Language="c#" Inherits="Telerik.TreeListExamplesCSharp.Integration.FilteringWithRadFilter.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<%@ 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" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" CssClass="demo-container">
        <div class="FilterContainer">
            <telerik:RadFilter RenderMode="Lightweight" runat="server" ID="RadFilter1" ExpressionPreviewPosition="Bottom" OnApplyExpressions="RadFilter1_ApplyExpressions">
                <FieldEditors>
                    <telerik:RadFilterTextFieldEditor FieldName="Title" DisplayName="Title"></telerik:RadFilterTextFieldEditor>
                    <telerik:RadFilterNumericFieldEditor FieldName="CategoryId" DisplayName="Category Id" DataType="System.Int32"></telerik:RadFilterNumericFieldEditor>
                    <telerik:RadFilterNumericFieldEditor FieldName="ParentId" DisplayName="Parent Id" DataType="System.Int32"></telerik:RadFilterNumericFieldEditor>
                </FieldEditors>
            </telerik:RadFilter>
        </div>
        <br />
        <br />
        <telerik:RadTreeList RenderMode="Lightweight" runat="server" ID="RadTreeList1" AllowSorting="true" AllowPaging="true" OnNeedDataSource="RadTreeList1_NeedDataSource" PageSize="20" DataKeyNames="CategoryId" ParentDataKeyNames="ParentId" AutoGenerateColumns="false">
            <Columns>
                <telerik:TreeListBoundColumn DataField="CategoryId" UniqueName="CategoryId" HeaderText="CategoryId"></telerik:TreeListBoundColumn>
                <telerik:TreeListBoundColumn DataField="Title" UniqueName="Title" HeaderText="Title"></telerik:TreeListBoundColumn>
                <telerik:TreeListBoundColumn DataField="ParentId" UniqueName="ParentId" HeaderText="ParentId"></telerik:TreeListBoundColumn>
            </Columns>
        </telerik:RadTreeList>
    </telerik:RadAjaxPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance