How to Filter a GridViewComboBoxColumn by DisplayMember
Environment
Product Version | Product | Author |
---|---|---|
2019.3.1022 | RadGridView for WinForms | Desislava Yordanova |
Description
By default, the filter options for the GridViewComboBoxColumn depends on the type of the specified ValueMember. Hence, if you set the ValueMember to be the unique numeric identifier of an object used in the DataSource collection, you will see filter options for numeric values in your case.
In addition, the column requires selecting a certain item from the drop down in order to filter the grid rows.
A common requirement is to filter by a sub-string and type only a part of the text without the necessity to select a certain item from the drop down.
Solution
In order to allow filtering by using a text box editor and filtering by the text that is displayed in the column, you need to set the GridViewComboBoxColumn.FilteringMode property to GridViewFilteringMode.DisplayMember and replace the default editor in the filter row with a RadTextBoxEditor in the RadGridView.EditorRequired event.
As a result you will get the filter options valid for string types:
Text filter options
The dafult editor for the filtering row will be a pure text box:
Text editor for the filtering row