This question is locked. New answers and comments are not allowed.
I am passing in dates to action method in the route like this:
http://mydomain/{controller}/{action}/2012-06-19
The action method receives this value in a "startDate" parameter on the action method and it is converted into a DateTime. So far so good.
Next I construct a ViewModel that contains a StartDate property of type DateTime. The date value passed into the action method is set as the value of the ViewModel's StartDate property. This ViewModel is passed to the View.
In my view I want to display a DatePicker using this date so I have the following:
@(Html.Telerik().DatePickerFor(x => x.StartDate)
I would expect that the DatePicker's value would be taken from the value in the ViewModel. However, the DatePicker control shows the date as "2012-06-19" instead, presumably taking the value from the RouteValues collection instead.
How do I get the DatePickerFor method to use the value from my ViewModel? I tried .DatePicker().Name("startDate").Value(Model.StartDate) but it still shows "2012-06-19" in the DatePicker control.
Regards,
Dave
http://mydomain/{controller}/{action}/2012-06-19
The action method receives this value in a "startDate" parameter on the action method and it is converted into a DateTime. So far so good.
Next I construct a ViewModel that contains a StartDate property of type DateTime. The date value passed into the action method is set as the value of the ViewModel's StartDate property. This ViewModel is passed to the View.
In my view I want to display a DatePicker using this date so I have the following:
@(Html.Telerik().DatePickerFor(x => x.StartDate)
.Min(Model.VitalSign.MinimumDate))
I would expect that the DatePicker's value would be taken from the value in the ViewModel. However, the DatePicker control shows the date as "2012-06-19" instead, presumably taking the value from the RouteValues collection instead.
How do I get the DatePickerFor method to use the value from my ViewModel? I tried .DatePicker().Name("startDate").Value(Model.StartDate) but it still shows "2012-06-19" in the DatePicker control.
Regards,
Dave