A newer version of this page is available. Switch to the current version.

ASPxFilterControl Class

Represents a filter control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll


public class ASPxFilterControl :
Public Class ASPxFilterControl
    Inherits ASPxFilterControlBase
    Implements IControlDesigner

The following members accept/return ASPxFilterControl objects:


The ASPxFilterControl is a stand-alone control that allows end-users to build filter criteria. It does not require any SQL syntax and doesn't have any limitations regarding filter condition complexity. With the ASPxFilterControl, you can construct any number of filter conditions, combined by any logical operator, and apply them to controls or to a data source.



The ASPxFilterControl isn't designed to operate with the bound source control. To enable end-users to construct filter criteria, you should manually create filter columns and add them to the ASPxFilterControl.Columns collection. The ASPxFilterControl provides eight column types (text, spin, combobox columns, etc.). The image below shows how to create filter columns at design time:


The example below demonstrates how to create a filter column in code:

private void CreateSpinEditColumn(ASPxFilterControl filterControl, string propertyName, 
    string displayName) {
    FilterControlSpinEditColumn filterColumn = new FilterControlSpinEditColumn();
    filterColumn.PropertyName = propertyName;
    filterColumn.DisplayName = displayName;

The current filter expression is returned by the ASPxFilterControlBase.FilterExpression property. After the filter expression has been constructed by an end-user, you can apply it to the ASPxFilterControl. To do this, use the server ASPxFilterControlBase.ApplyFilter or client ASPxClientFilterControl.Apply methods.

<dx:ASPxButton runat="server" ID="btnApply" Text="Apply" AutoPostBack="false" 
    <ClientSideEvents Click="function() { filter.Apply(); }" />

Once applied, the filter expression can be obtained via the ASPxFilterControlBase.AppliedFilterExpression property. To apply the filter to a control or data source, handle the ASPxClientFilterControl.Applied event.

<dx:ASPxFilterControl ID="filter" runat="server" ClientInstanceName="filter">
        <dx:FilterControlColumn PropertyName="ProductName"  />
        <dx:FilterControlColumn PropertyName="OrderDate" ColumnType="DateTime"  />
        <dx:FilterControlColumn PropertyName="UnitPrice"  />
     <ClientSideEvents applied="function(s, e) { grid.ApplyFilter(e.filterExpression); }"/>

To reset the current filter expression to a previously applied filter expression, use the ASPxFilterControlBase.ResetFilter or ASPxClientFilterControl.Reset method. This sets the ASPxFilterControlBase.FilterExpression property to the ASPxFilterControlBase.AppliedFilterExpression property's value.

<dx:ASPxButton runat="server" ID="btnReset" Text="Reset" AutoPostBack="false"