Skip to main content
All docs
V23.2

GridOptionsFilter.InHeaderSearchMode Property

Gets or sets whether built-in column header search boxes are enabled. They allow users to search for column data or filter against columns.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v23.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

[DefaultValue(GridInHeaderSearchMode.Default)]
[XtraSerializableProperty]
public virtual GridInHeaderSearchMode InHeaderSearchMode { get; set; }

Property Value

Type Default Description
GridInHeaderSearchMode Default

A value that specifies whether built-in column header search boxes are enabled.

Available values:

Name Description
Default

Equivalent to the Disabled option.

Disabled

Built-in column header search boxes are disabled.

TextFilter

Built-in column header search boxes are enabled, and are used to filter against columns.

TextSearch

Built-in column header search boxes are enabled, and are used to search in columns.

Property Paths

You can access this nested property as listed below:

Object Type Path to InHeaderSearchMode
GridView
.OptionsFilter .InHeaderSearchMode

Remarks

Set the InHeaderSearchMode property to TextFilter or TextSearch to enable built-in search boxes within the View’s column headers.

The GridColumn.OptionsFilter.AllowInHeaderSearch property allows you to disable header search boxes for individual columns.

Note

Filter Against Columns — ‘TextFilter’ Mode

If the InHeaderSearchMode property is set to TextFilter, users can type text in the search boxes to filter against the columns.

Data Grid - In-header search box - Filter mode

Search in Columns — ‘TextSearch’ Mode

If the InHeaderSearchMode property is set to TextSearch, users can type text in the search boxes to search for column data. The grid highlights cell text that matches the specified search string.

Data Grid - In-header search box - Search mode

Use the following shortcuts to navigate between search results:

  • CTRL+DOWN or F3 — Navigates to the next search result.
  • CTRL+UP or SHIFT+F3 — Navigates to the previous search result.

Search Specifics

  • The Data Grid automatically updates search results when you or users update data, expand/collapse group rows, and filter or sort data.
  • The Data Grid does not search in collapsed rows (when data is grouped).
  • A search is not performed against group row text.
  • A search against large recordsets (more that 100,000 records) can slow down the grid’s performance.

Example

The following example enables search boxes for all grid columns except the colOrderID column:

gridView1.OptionsFilter.InHeaderSearchMode = GridInHeaderSearchMode.TextFilter;
colOrderID.OptionsFilter.AllowInHeaderSearch = DevExpress.Utils.DefaultBoolean.False;

Activate Search Boxes

If a column’s header search box is enabled, users can activate it as follows:

  • Hover the mouse pointer over the column header and click the search icon (Data Grid - Search Icon).
  • Move focus to the column and press the CTRL+F shortcut. If an in-place editor is active, it intercepts the shortcut, and the search box is not invoked.

    The CTRL+F shortcut opens the Find Panel if the search box is disabled for the focused column. Also note that if header search boxes are enabled, the Find Panel cannot be embedded in the Group Panel (see FindPanelLocation).

Search Syntax

The following list demonstrates sample search expressions supported in column header search boxes:

  • Spa — Finds records whose column values contain this string (in non-numeric columns).
  • 10 — Finds records whose column values are equal to “10” (in numeric columns).
  • =Spain or =22 — Finds records whose column values are equal to the specified value.
  • <>40 — Finds records whose column values are not equal to the specified value.

    Other supported comparison operators include: <, >, <=, >=, and != (equivalent to <>).

  • =USA,Spain,Germany or =USA;Spain;Germany — Finds records whose column values are equal to any of these listed values.
  • [10:20] or [10..20] — Finds records whose column values belong to the specified inclusive range.

Text search is case-insensitive.

Standard Filter Drop-down List

If a header search box is enabled for a column, the Data Grid hides the header’s filter button (GridView- Column Filter Button) used to invoke the standard filter drop-down list. In this case, users can open the filter drop-down list from the column header’s context menu.

Data Grid - Show Column Filter menu item

Specify and Clear Search Text in Code

Use the GridColumn.SearchText property to specify text in a search box.

colQuantitycolQuantity.SearchText = ">=20";

Set the GridColumn.SearchText property to an empty string, or call the GridView.ClearInHeaderSearchText method to clear the search text.

See Also