I’ve set up a MvcContrib Grid with paging and filtering as described here. It all works great, except when I try to add filtering by date.
My web configuration includes:
<globalization
uiCulture="en-GB"
culture="en-GB"
/>
I’m using the jquery datepicker to enter the date:
<script type="text/javascript">
$(function () {
if (!Modernizr.inputtypes.date) {
$.getScript("/Scripts/jquery-ui-1.8.11.min.js", function () {
$("input[type='datetime']").datepicker({ dateFormat: "dd/mm/yy" });
});
}
});
</script>
The dates show as dd/mm/yy during data entry in the filter.
They show as dd/mm/yy in the controller.
But in validation they are treated as mm/dd/yy.
Does anyone have any ideas?
Came back to this problem and got it working, thanks to the link to Scott Hanselman’s Blog.
First I downloaded the jquery.global plugin from Nuget.Then I added the following lines to my _layout.cshtml
and this to the system.web section of web.config:
This has got it working for me.