Applying filter to a grid from server-side

2 posts, 0 answers
  1. subith
    subith avatar
    1 posts
    Member since:
    Jan 2011

    Posted 07 Jan Link to this post

    Kendo.Mvc, Version=2020.3.1118.0

    I am trying to apply filter to a grid from server-side. Below is the implementation. 

    public static AjaxDataSourceBuilder<T> Configure<T>(this AjaxDataSourceBuilder<T> source, UserGridPreferenceVM userPreferences) where T : class
        if (userPreferences.Filter?.Filters != null && userPreferences.Filter.Filters.Length > 0)
            List<FilterDescriptor> filters = new List<FilterDescriptor>();
            foreach (FilterElement filter in userPreferences.Filter.Filters)
                filters.Add(new FilterDescriptor(filter.Field, GetFilterOperator(filter.Operator), filter.Value));
            source.Filter(s =>
        return source;


    I have 2 questions.

    1. When the grid loads the filter condition is set but value of the filter is not set.

    2. How we can apply Logic operator "And"/"Or" to the filter?


    Really appreciated if you can help with this issue.

  2. Georgi
    Georgi avatar
    698 posts

    Posted 12 Jan Link to this post

    Hello Subith,

    I would suggest you to add the filters through the API of the grid.


        .DataSource(dataSource => dataSource
            .Filter(x=> x.Add(y=> y.Freight).IsGreaterThan(12).And().IsLessThan(25))

    This way, not only the data will be filtered, but the filter UI will reflect the applied filters. Additionally, the above configuration demonstrates how to chain filter expressions with AND/OR.

    I hope this helps.

    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at

Back to Top