I\'ve got a MVC 3 view which displays a list of items that can be filtered by date.
The filter is a textbox which has been jQueryUI-fied into a date picker.
you can add a new route to routing table using
routes.MapRoute(
"SearchRoute",
"{controller}/{action}/{id}",
new {controller = "Home", action = "Index", reportedDate = UrlParameter.Optional}
);
then the your url will become
MyController/Search/30-05-2011
that will make your controller action catch the value of reportedDate
but you have to chaneg the date format you used in your date picker
Right, well the problem is the date format after all, it looks like the expected date format string is mm/dd/yyyy
and the date is coming in as dd/mm/yyyy
Veli is right. If you want to use that Date format, you'll need a custom model binder for your DateTime. Take a look here:
How to specify date format for model binding?