DateTime from Javascript post to Controller in ASP.NET results in null (01/01/0001)
- by Geoffrey
This is driving me crazy, similar to this. If I use a standard form and no javascript the controller correctly binds the datetime. However when I'm posting from a form it always binds as null:
"MyObject.Name": "Test name",
"MyObject.Date": "5/1/2001"
I've tried a couple of variations, 5-1-2001, etc. but cannot seem to get it to take. I can confirm that it is being passed to the server as it shows up in the Request.Form string. My culture is Gregorian and I've set:
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
In Application_BeginRequest(). What gives?