Filter DateTime column by range

2 posts, 0 answers
  1. Patrik
    Patrik avatar
    17 posts
    Member since:
    Jan 2013

    Posted 16 Jul 2013 Link to this post


    I am using RadGridView to display some data and one of the columns is of type DateTime. Filtering mode is set to FilterRow. How can I filter the column by date range like I can in ASP.NET AJAX RadGrid? 

    Changing filtering mode to popup is not an option for me, I need it to be filter row. 

    I would also like to know how to hide the filter button and set one default filter function like contains? All of these things can be easily done on web RadGrid, but I am not able to do it with WPF RadGrid.

    Thank you,

  2. Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 17 Jul 2013 Link to this post


    I am afraid that RadGridView can only allow one filter editor (it is a RadDateTimePicker hence one value) in the "Filter Row" mode by design. We don't support the Between operator as well so there is no way to do this in the filter row mode where you can only have a single editor.

    Unfortunately, the Popup mode is the only mode that allows date range filtering since it contains two field filter editors, i.e. two RadDateTimePicker's.

    The only way to achieve something similar would be to turn off all built-in filtering and then implement manual filtering. The manual filtering can be achieved by editing the control template of the GridViewHeaderCell and placing the needed UI controls there, I suppose they can be two RadDateTimePickers. From the values chosen in those date picker you can then perform programmatic filtering of the grid as described here. It is like filtering the grid programmatically through an external UI only that this external UI will be stuck inside the GridViewHeaderCell control template. I am not sure how beautiful this will look like. Unfortunately, we do not have an example or a sample project for such a custom requirement.

    The default filter operator can be changed as described here.

    The button can be hidden by editing the control template of the FieldFilterEditorControl with Expression Blend. More about styling and templates can be found here.

    Rossen Hristov
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top