Filtering in Telerik RadGrid can be enabled/disabled using RadGrid.AllowFilteringByColumn or GridTableView.AllowFilteringByColumn properties. Then each column that supports filtering (GridBoundColumn, GridCheckBoxColumn, etc) shows a filter box in a GridFilteringItem beneath the corresponding header. After pressing the filter button, next to the filter box the grid displays only the records matching the filter criteria regarding the settings of all filter boxes.
The filtering menu is independent for each column in RadGrid. Each column has a DataType property, which can define the filtering expressions for that column. This property is set automatically by Telerik RadGrid when data binding. However, you can set this property explicitly and change the data type of a column and thus its filtering expressions.
For example, you have a column with data type set to integer and for some reason you need to use "StartsWith" filtering expression. As this expression is not available for integers, Telerik RadGrid will not show it in the dropdown list. In order to use "StartsWith", you need to set the DataType for that column explicitly to string.
All filters in a single table are applied using AND operator, i.e. only items (grid rows) that comply all filters will be displayed.
When you have more than one value to filter on, values should be entered separated by a space.
RadGrid filters data internally, after data binding. In addition to the available filter expressions, you can create your own filter using the GridFilterFunction class.
Users can set a filter expression based on the rules specified in the corresponding column properties: GridColumn.FilterFormatString.

You can set the default filter function and the default filter value that will appear in the filter text box through the properties of GridColumn - CurrentFilterFunction and CurrentFilterValue (Telerik RadGrid will display this value as an initial filter but will NOT perform the filtering). Additionally, you can disable the filtering option for some of the grid columns by setting their AllowFiltering property to false.
You can specify the group of possible filter functions that Telerik RadGrid would display by setting the FilterListOptions property. It has three possible values:
- VaryByDataType - the default value. Filter functions list depends on the DataType of the column. For example, filter functions "Starts with", "Ends With... " will not be available for columns with DataType integer.
- VaryByDataTypeAllowCustom - the same as the above, but additional custom filter functions will be enabled. This means that the user can specify key words and fields form the datasource in the filter text box.
 |
It is up to the developer to set the proper constraints on event handler ItemCommand when command name is "Filter". |
- AllowAllFilters - All filters will be displayed. Note that some data types are not applicable to some filter functions. For example 'like' function cannot be applied for integer data type. In such cases you should handle the filtering in a custom manner, handling RadGrid.ItemCommand for 'Filter' command or FilterCommand. Filtering can be fully customized by setting the value of GridTableView.FilterExpression property. Note that setting the value of this property will override all other filtering done by Telerik RadGrid.
The filtering menu of Telerik RadGrid is presented by single object server-side. This way of implementation has been chosen to speed up the grid performance by merely creating one menu instance server side and cloning the instance for different columns.
The filtering menu is independent for each column in RadGrid - this means that the filtering menu options vary by the DataType of the corresponding column. Hence integer column will have one set of filter menu options (EqualTo, NotEqualTo, GreaterThan, LessThan, etc.), string column will have additional options (Contains, StartsWith. etc.) and so on.
Further information about grid known filter functions and filter list options you can find in these articles from the grid documentation:
Filter list options
Grid known filter functions
In some cases when you have Telerik RadGrid positioned absolute, you may find the filtering pop-up hidden behind Telerik RadGrid. You can easily fix the problem by setting the Z-index of the corresponding element in the ASPX to 0:
| ASPX/ASCX |
Copy Code |
|
<rad:RadGrid id="RadGrid1" style = "Z-INDEX: 0; LEFT: 64; POSITION: absolute..." /> |