This project is read-only.

DateTime input doesn't set values

May 16, 2011 at 10:42 PM

I'm trying to get the DateTime control working but its not sending back the Date to the controller.

I implemented the date time on the view as this:


var DT = Html.DateTimeFor(model => model.TransactionDate, DateTime.Now, dateInCalendar: true



null, false, null


 But when I check the Controller it is failing on the model.TransactionDate saying it is required even though I populated it on the UI.  It seems like the value is not being passed down.

Can someone help?



May 16, 2011 at 11:48 PM
Edited May 17, 2011 at 7:20 AM

I have resolved this one - should have read the manual I suppose!  Apparently you need to put a record in the Global.asax:






Inside the Application_Start routine.  This then lets the values be passed through.