Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Summaries
   [Expand]Data Editing
   [Collapse]Filtering and Locating Rows
    [Collapse]Filtering
     [Collapse]Filter Dropdowns
       Filter Dropdown: Excel Style
       Filter Dropdown: Regular
       Filter Dropdown: Checked
       Filter Dropdown: Calendar Style
     [Expand]Tutorials
      Filtering Overview
      Filter Settings
      MRU Filters
      Automatic Filtering Row
      Filter Editor
      Custom Filter Dialog
      Filtering in Code
     Locating Rows in Code
     Incremental Search
     Searching via Find Panel
     Tutorial: Incremental Search
     Tutorial: Search/Find Panel
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Filter Dropdown: Regular

This topic covers the specifics behind the regular Filter Dropdown lists. For general information about this and other types of Filter Dropdowns, refer to the Filter Dropdowns topic.

 

Filter Dropdowns display in the Excel-inspired style by default. To enable the regular Filter Dropdown lists for columns that display string and numeric values, set the WindowsFormsSettings.ColumnFilterPopupMode static property to Classic. This global setting can be overridden for a particular View or column using the ColumnViewOptionsFilter.ColumnFilterPopupMode and OptionsColumnFilter.FilterPopupMode properties, respectively. See WindowsFormsSettings.ColumnFilterPopupMode for details.

The regular Filter Dropdown displays the list of available values where only one item can be selected at a time.

Once a certain value is selected in the Filter Dropdown, a corresponding filter condition is applied to the current column. Recently selected filter values are accessible from the MRU section of the Filter Dropdown list and displayed at the top.

Features supported by regular Filter Dropdowns include:
  • One filter value can be selected simultaneously. Once a value is clicked/selected, the Filter Dropdown closes and the selected value filters the data. To enable multiple value selection, use checked Filter Dropdowns (see below).
  • MRU items
  • (Custom) item, used to invoke the Custom Filter Dialog (by default)
  • (Blanks) and (Non blanks) items, which allow for the filtering of records that contain Null values and empty strings
  • List customization using an event

All Filter Dropdown list elements are described in greater detail below.

Item Description Related API
Value items
(unique column values)
Selecting an item applies the following filter to the column.

[ColumnFieldName]=Value

If a column is currently filtered, opening the Filter Dropdown for this column displays all unique column values fetched from all records. If no filter is currently applied to a column, opening the Filter Dropdown for this column displays unique column values from the records that meet the current filter criteria. If you need to display column values fetched from all records (even from those that do not meet the current filter criteria), click the filter button while holding down the SHIFT key.

MRU items Selecting an item applies the following filter to the column.

[ColumnFieldName]=Value

Once a filter is applied, it is automatically added to the MRU column filter collection (GridColumn.MRUFilters). However, the currently applied filter does not display amongst the MRU filters within the column's Filter Dropdown list.

For information on MRU filters applied to Views, refer to the MRU Filters topic.
Double line Separates MRU filters from other items.
(All) Cancels any filtering against the current column.
(Custom) Opens the Custom Filter Dialog, which enables end-users to create filter criteria for the column using various filter operators (>, >=, LIKE, etc.). It is also possible to create filter criteria comprised of two filter conditions.
(Blanks) Creates a filter condition that selects records that contain the null value, DBNull value or an empty string in the column.

One of the following filter conditions is used:

IsNull([ColumnFieldName]) - For columns that contain null and/or DBNull values, and no empty strings.

IsNullOrEmpty([ColumnFieldName]) - For columns that contain null and/or DBNull values along with empty strings.

(Non-Blanks) Creates a filter condition that selects records that contain any value except the null value, DBNull value or an empty string in the column.

One of the following filter conditions is used:

Not IsNull([ColumnFieldName]) - For columns that contain null and/or DBNull values, and no empty strings.

Not IsNullOrEmpty([ColumnFieldName]) - For columns that contain null and/or DBNull values along with empty strings.

See Related API for "(Blanks)".
Custom items These items can be added in code using an event to provide custom filtration. For instance, for date columns, you can create a THIS MONTH custom filter item. Selecting this item applies filter criteria that select records that refer to dates within the current month. If a column displays country names, you can implement the "THE GREAT 8" or "EURO ZONE" custom items, etc.

See the Customizing Filter Dropdown section below to learn more.

ColumnView.ShowFilterPopupListBox

Expanded Invoke Filter Dropdown

An end-user can invoke the Filter Dropdown by clicking the column's filter button. To open the column's Filter Dropdown in code, call the ColumnView.ShowFilterPopup method.

Expanded Filter Dropdown Height and Record Count

The following are the properties that affect the height and contents of column Filter Dropdowns:

Expanded Customizing Filter Dropdown

The ColumnView.ShowFilterPopupListBox event allows you to customize the regular Filter Dropdown by:

  • adding custom items;
  • replacing or deleting existing items;
  • changing item display text.
The event's e.ComboBox.Items parameter provides access to the displayed item collection. The following table describes how to identify regular Filter Dropdown list items in the e.ComboBox.Items collection:
Item An object representing this item in the e.ComboBox.Items collection
Value items
(unique column values)
FilterItem objects represent these items. An item's FilterItem.Value property refers to any object except for the FilterItem and the ColumnFilterInfo. This value is used to create a filter condition when the item is selected.

[ColumnFieldName] = Value

MRU filter items FilterItem objects represent these items. An item's FilterItem.Value property refers to a ColumnFilterInfo object. The filter criteria specified by the FilterItem.Value is applied to a data source 'as is' when the item is selected.
Double line A System.String object represents this item within the list by and its value is equal to "-".
(All) FilterItem objects represent these items. The item's FilterItem.Value property refers to another FilterItem object. The latter's Value property contains 0.
(Custom) FilterItem objects represent these items. The item's FilterItem.Value property refers to another FilterItem object. The latter's Value property contains 1.
(Blanks) FilterItem objects represent these items. The item's FilterItem.Value property refers to another FilterItem object. The latter's Value property contains 2.
(Non Blanks) FilterItem objects represent these items. The item's FilterItem.Value property refers to another FilterItem object. The latter's Value property contains 3.
Custom items Custom items can only be added to the list manually, using the e.ComboBox.Items collection of the ColumnView.ShowFilterPopupListBox event. You can create custom items to represent complex filter criteria or for filter conditions with a comparison operator other than Equals.

FilterItem objects must represent these items. An item's FilterItem.Value property must refer to a ColumnFilterInfo object specifying filter criteria. These filter criteria are applied to the data source 'as is' when the item is selected.

Expanded Example: Adding a Value Item

The following code shows how to remove all the items in a regular filter dropdown list except for the predefined ones, and then add a new value item ('VIP Client') to the CustomerID column. It's assumed that the columns' MRU filter items are disabled (the ColumnViewOptionsFilter.AllowColumnMRUFilterList property is set to false):

Selecting this item applies the ("[CustomerID] = 'DUMON'") filter to the bound data source:

Expanded Example: Adding a Custom Item

The following example illustrates how to use the ColumnView.ShowFilterPopupListBox event to add two custom items ("TODAY" and "THIS MONTH") to the regular filter dropdown list for the OrderDate column.

When an end-user selects the TODAY item, an appropriate filter is applied to the column and this selects all the records whose OrderDate field contains a date between 12:00 AM and 11:59 PM today. Similarly, the THIS MONTH filter item selects the records which refer to the current month.

The next image shows the Grid View after selecting the 'TODAY' filter item:

Filter strings for the TODAY and THIS MONTH items are created via the custom getFilterString function. The text for the items to display in the filter panel is retrieved via the custom getFilterDisplayText function.

For information on creating ColumnFilterInfo objects to represent specific filter criteria, refer to the Filtering in Code topic.

How would you rate this topic?​​​​​​​