Filter - Working With Items And Expressions

(OrderDate = '12/3/2016 12:00:00 AM' AND (ShipCountry = 'Bulgaria' OR ShipCountry = 'Germany'))
  • And
  • Or
  • Not And
  • Not Or
  • Contains
  • DoesNotContain
  • StartsWith
  • EndsWith
  • EqualTo
  • NotEqualTo
  • GreaterThan
  • LessThan
  • GreaterThanOrEqualTo
  • LessThanOrEqualTo
  • Between
  • NotBetween
  • IsEmpty
  • NotIsEmpty
  • IsNull
  • NotIsNull
  • ShipCountry
  • OrderDate

Order DateShip Country
12/3/2016 2:00:00 AMBulgaria
12/3/2016 12:00:00 AMFrance
12/3/2016 11:00:00 AMGermany
12/4/2016 12:00:00 AMFrance
12/2/2016 12:00:00 AMFrance
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

This demo demonstrates how you could subscribe to RadFilter ExpressionItemCreated event and access and manipulate individual items.

Additionally, a time independent filtering functionality is shown by using the RadFilterQueryProvider.OnExpressionEvaluated delegate where the every EqualTo and NotEqualTo filter functions are swapped for Between and NotBetween so they could filter for the entire day and not for a specific hour, minute, second.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.FilterExamplesCSharp.CustomizingRadFilter.DefaultCS" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</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">
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1">
      <telerik:RadFilter RenderMode="Lightweight" runat="server" ID="RadFilter1"
        ExpressionPreviewPosition="Bottom"
        OperationMode="ServerAndClient"
        OnExpressionItemCreated="RadFilter1_ExpressionItemCreated"
        OnApplyExpressions="RadFilter1_ApplyExpressions">
        <FieldEditors>
          <telerik:RadFilterDropDownEditor FieldName="ShipCountry" DataTextField="ShipCountry"
            DataValueField="ShipCountry" />
          <telerik:RadFilterDateFieldEditor FieldName="OrderDate" PickerType="DatePicker" />
        </FieldEditors>
      </telerik:RadFilter>
      <br />
      <div>
        <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" AllowPaging="true" AllowSorting="true" PageSize="5"
          runat="server" EnableLinqExpressions="false" OnNeedDataSource="RadGrid1_NeedDataSource">
        </telerik:RadGrid>
      </div>
    </telerik:RadAjaxPanel>
  </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?