Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Selection
   [Collapse]Filtering and Searching
     Filtering Overview
     Automatic Filter Row
     Filter Dropdown
     Filter Editor
     Filter Modes and Custom Filtering
     Filtering in Code
     Filter Expressions
     Search Panel
     Incremental Search
     Filtering Nodes
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Data Scrolling
   [Expand]Focus and Navigation
   [Expand]Conditional Formatting
   [Expand]Drag-and-Drop
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Filtering in Code

In code, you can apply filters to the grid and individual columns. Applying a filter to the grid clears all column filters (if any).

Expanded Applying a Filter to the Grid

To apply a filter to the grid, use the DataControlBase.FilterCriteria or DataControlBase.FilterString property. Both properties specify the grid's filter, that can consist of multiple conditions applied to multiple columns.

When using the DataControlBase.FilterCriteria property you should create a CriteriaOperator object or its descendant, representing the filter expression:

Or you can use the CriteriaOperator.Parse method:

The DataControlBase.FilterString property allows you to specify the filter string:

Filters that are set using DataControlBase.FilterCriteria and DataControlBase.FilterString properties can be modified by the end-user. To set a filter criteria that is constantly applied to the grid and cannot be modified by the end-user, use the DataControlBase.FixedFilter property.

Expanded Applying a Filter to a Column

To apply a filter to a column, use the ColumnBase.AutoFilterValue property. The type of the comparison operator used to create filter conditions for the current column, is specified by the ColumnBase.AutoFilterCondition property. You can also use the DataControlBase.MergeColumnFilters method that combines the specified filter with the grid's current filter with the AND operator.

To identify whether a filter is applied to a column, use the column's ColumnBase.IsFiltered property. If this property returns true, you can obtain the column's filter using the DataControlBase.GetColumnFilterCriteria or DataControlBase.GetColumnFilterString method.

Expanded Clearing Filters

To clear the grid's filter, set the DataControlBase.FilterCriteria property to null or the DataControlBase.FilterString property to an empty string.

To clear a column's filter, use the DataControlBase.ClearColumnFilter method.

Expanded See Also

Is this topic helpful?​​​​​​​