This is a migrated thread and some comments may be shown as answers.

Filter DateTime column by range

1 Answer 345 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Patrik
Top achievements
Rank 1
Patrik asked on 16 Jul 2013, 03:19 PM
Hi,

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,

Patrik

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 17 Jul 2013, 07:14 AM
Hi,

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.

Regards,
Rossen Hristov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
Tags
GridView
Asked by
Patrik
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or