New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

filter

Method which triggers filter command for the column with UniqueName (set on the server) passed as a first argument. The second argument should be value to compare (or two values separated by [space] for between filter pattern) or an empty string for EqualTo, NoFilter, IsNull, etc. The last third argument has to be a value from the Telerik.Web.UI.GridFilterFunction enumeration which internally recognizes the filter criteria that should be applied. All server-side filtering capabilities of RadGrid are applicable here as well. See the topic describing the fireCommand method for further details.

filter(colUniqueName, valueToCompare, filterFunction, shouldUpdateFilterControl)
colUniqueNameStringThe UniqueName of the column that will be filtered.
valueToCompareOptional argument (String, Integer, etc.)The value which will be used for the comparison against the entire set of data through the filter criteria.
filterFunctionEnumeration valueThe filter pattern that will be applied.
shouldUpdateFilterControlBoolean (Optional)Determines whether the filter control will be updated with the relevant filter value applied by the grid filter expression. The default value is false.

Example:

JavaScript
function RemoveFilter() {
    var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
    masterTable.filter("OrderID", "", Telerik.Web.UI.GridFilterFunction.NoFilter);
}

function ApplyGreaterThanFilter() {
    var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
    masterTable.filter("OrderID", 10254, Telerik.Web.UI.GridFilterFunction.GreaterThan, true);
}

function ApplyBetweenFilter() {
    var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
    masterTable.filter("OrderID", "10256 10260", Telerik.Web.UI.GridFilterFunction.Between, true);
}

Telerik.Web.UI.GridFilterFunction enumeration

Internal integer valuePublic value
0NoFilter
1Contains
2DoesNotContain
3StartsWith
4EndsWith
5EqualTo
6NotEqualTo
7GreaterThan
8LessThan
9GreaterThanOrEqualTo
10LessThanOrEqualTo
11Between
12NotBetween
13IsEmpty
14NotIsEmpty
15IsNull
16NotIsNull
17Custom

When using client-side binding to RadClientDataSource, you need to add filter expressions directly to the data source through the dataSourceReference.get_filterExpressions().add() method. You can find similar example in the ClientDataSource - Filtering live demo.

Not finding the help you need?
Contact Support