I have this application, and the default date format must be dd/MM/yyyy (the language is Brazilian Portuguese).
I already had set culture and UI culture to pt-BR and now myDate.ToShortDateString() returns the dates as I want. I have no trouble displaying them.
The problem is, when the user fills an input field with a date such as 17/08/2011 and submits the form the DateTime parameter to my action becomes null. If I supply a date in the format 08/17/2011, it works fine.
How can I make the ASP.Net MVC model binding to parse my dates correctly?
I found what happended. My form was posting via
GETmethod, and the MVC just uses the culture for an action parameter when it’s passed in theRouteDataor by the form viaPOSTmethod.I just changed the form to
POSTmethod and it worked.