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

[Solved] ToGridModel() and nullable DateTime problem

0 Answers 15 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.
Sascha
Top achievements
Rank 1
Sascha asked on 21 Feb 2013, 07:57 AM
Hello, I am using the Telerik MVC Grid with client operation mode. I just introduced some nullable DateTime fields and having a big problem since.

If the user clicks a button, a controller is called, including submitting the page, orderby and filter attributes of the grid.
Based on these fields I want to get exactly the same datasets on the server that are present on the client (after filtering).

But this does not seem to work with nullable DateTime's?
An example: User filters using 'CurrentDate lower than 2012-12-12' so the grid shows all datasets that are before this date AND all datatsets where CurrentDate == null. This is the wanted behaviour.

The filter-string in this case is something like 'CurrentDate~lt~'2012-12-12''. If I now feed the ToGridModel() method with this filter like so:
GridModel model = new DBEntities().Aktion.ToGridModel(page, 0, string.Empty, string.Empty, filter);
I am only getting datasets before the given date, but not the nulls. This breaks my whole project right now, so is there any fix to this?

It's even getting worse if the user is filtering by several fields. Due to the fact that the filter-expressions are linked with an 'and' the ToGridModel() mostly returns zero datasets while the clients' grid is showing hundreds.
Tags
Grid
Asked by
Sascha
Top achievements
Rank 1
Share this question
or