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

[Solved] Optional Custom filtering with a 2 Dates

0 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jmo
Top achievements
Rank 1
jmo asked on 02 Nov 2010, 04:25 PM
I have 2 date combos and I want to do some custom filtering

I understand how to use both combos to filter between the selected vaues as per below.

.Filterable(filtering => filtering
                            .Filters(filters => filters
                                .Add(o => o.DOB).IsGreaterThanOrEqualTo(DateTime.Parse(ViewData["StartDOB"].ToString())).And().IsLessThanOrEqualTo(DateTime.Parse(ViewData["EndDOB"].ToString()))                               
                        ))

What I want to achieve is making this optional.

I want to allow the user to choose a value from the StartDOB combo and if they do NOT select a value from the EndDOB combo, I want an exact match on the StartDOB - if they DO select an EndDOB, then we do a date range filter like the above.

Is this achievable with custom filtering?

many thanks in advance
Tags
Grid
Asked by
jmo
Top achievements
Rank 1
Share this question
or