[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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
   [Collapse]Get Started With Data Grid and Views
     [Expand]Appearance and Conditional Formatting
     [Expand]Data Editing
     [Expand]Hit Information
     [Expand]Data Binding and Working with Columns
     [Expand]Grid View - Columns, Rows and Cells
     [Expand]Banded Views
     [Expand]WinExplorer View
     [Expand]Tile View
     [Collapse]Filter and Search
       Tutorial: Column Filter Dropdowns
       Tutorial: Data Filtering Basics and Filter Panel Settings
       Tutorial: Excel-Style Custom Filter Dialog
       Tutorial: Filter Editor
       Tutorial: Filter Row
       Tutorial: Filtering and Locating Rows API
       Tutorial: Incremental Search
       Tutorial: Search/Find Panel
     [Expand]Split Presentation
     [Expand]Row Preview Sections
   [Expand]Data Binding
    Unbound Columns
   [Expand]Data Editing and Validation
   [Expand]Filter and Search
   [Expand]Focus and Selection Handling
    Format Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
   [Expand]Batch Modifications
    Hit Information
    Popup Menus
   [Expand]Save and Restore Layout
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Tutorial: Incremental Search

This walkthrough is a transcript of the Incremental Search video available on the DevExpress YouTube Channel.

The tutorial will show you how to enable the Incremental Search feature for the entire view or individual columns. You will also learn how to perform custom actions in response to search string changes and how to initiate or end the search from code.

Expanded Enabling the Incremental Search Feature

To enable the incremental search, select the View, expand its GridView.OptionsBehavior property and enable the GridOptionsBehavior.AllowIncrementalSearch option.

Run the application to see this feature in action.

Expanded Using the Incremental Search Feature

First, search for a record by product name. Focus the corresponding column and then start typing the search text. Type 'c' to move focus to the first row where product name starts with this character. Then, type 'h' to locate a record where the product name starts with 'ch', and so on.

There may be several rows containing cells matching the search criteria. To continue searching forward using the same criterion, press the CTRL+DOWN ARROW key combination. To return back, press CTRL+UP ARROW. You can also use BACKSPACE to modify the search string.

In a similar manner, you can focus another column to search against its values.

Expanded Disabling Incremental Search for Individual Columns

Close the application and disable the incremental search for one of the columns. Select the Category column, expand the GridColumn.OptionsColumn property and set the OptionsColumn.AllowIncrementalSearch option to false.

Run the application and focus the Category column to see that the incremental search no longer works. You can still use the feature in other columns.

Expanded Responding to Search String Changes

You might want to respond to changes in the search string while users search for records. To do this, handle the View's BaseView.KeyUp event. In the event handler, call the DisplayIncrementalSearchText method, which in turn obtains the current search text using the View's ColumnView.GetIncrementalText method and displays this string in the status bar.

Run the application to see the result. Start incremental search to see that the status bar displays the current search string.

Expanded Starting and Stopping Incremental Search in Code

You can also initiate or end incremental search operations from code. The Start Incremental Search and Stop Incremental Search buttons will be used for this purpose. In the first button's Click event handler, call the View's GridView.StartIncrementalSearch method and pass the 'cha' text as a parameter. Display this text in the status bar using the previously discussed DisplayIncrementalSearchText method. Focus to the Product Name column via the View's ColumnView.FocusedColumn property.

The Click event handler for the second button simply calls the GridView.StopIncrementalSearch method.

Run the application. When you click the Start Incremental Search button, the grid locates the nearest record where the product name starts with 'cha', and displays this text in the status bar. You can continue typing to narrow down the search. The Stop Incremental Search button disables the incremental search mode.

Expanded See Also

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