Telerik Extensions for ASP.NET MVC

This help topic discusses the filtering feature of Telerik Grid for ASP.NET MVC

Important

All Telerik UI components need a ScriptRegistrar component in order to output their JavaScript objects and register their JavaScript files. The ScriptRegistrar component should be defined *after* all other UI components in the page. If you create the components on the client-side and do not use the MVC extensions, you need to manually register all requried JavaScript files. For further information check this help topic (Step 4 - Register Scripts)

Filtering allows the user to view only the relevant data in Telerik Grid for ASP.NET MVC. The grid displays type agnostic drop down menu with the available filtering operators.

To enable filtering use the Filterable()()()() method:

CopyView
<%= Html.Telerik().Grid(Model)
        .Name("Grid")
        .Filterable()
%>
This would enable filtering with default configuration - all bound columns of primitive type will be filterable.

Filtering Configuration

You can customize the filtering behavior by using the Filterable(Action<(Of <<'(GridFilterSettingsBuilder>)>>)) method. It allows you to enable filtering based on some condition via the Enabled(Boolean) method:
CopyC#
<%= Html.Telerik().Grid(Model)
        .Name("Grid")
        .Filterable(filtering => filtering.Enabled((bool)ViewData["enableFiltering"]))
%>
You can disable filtering for a particular column by using the Filterable(Boolean) method:
CopyC#
<%= Html.Telerik().Grid(Model)
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.OrderID).Filterable(false);
        })
        .Filterable()
%>
You can also configure the filters which will be applied initially:
CopyC#
<%= Html.Telerik().Grid(Model)
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.OrderID);
        })
        .Filterable(filtering => filtering.Filters(filters => 
            filters.Add(o => o.OrderID).IsGreaterThan(11000))))
%>

See Also

Other Resources