This question is locked. New answers and comments are not allowed.

Ratna Karthik Chandu M
Top achievements
Rank 1
Ratna Karthik Chandu M
asked on 14 Sep 2010, 01:13 PM
<%= Html.Telerik().DatePickerFor(model => model.InventoryTypeTemplateInstance.ActivationDate).MinDate(DateTime.MinValue).MaxDate(DateTime.MaxValue)%>
The ActivationDate filed is Not Nullable, So in View it is displaying the minimum date value, i want the datepicker to display the empty string.
The ActivationDate filed is Not Nullable, So in View it is displaying the minimum date value, i want the datepicker to display the empty string.
5 Answers, 1 is accepted
0

Peter
Top achievements
Rank 1
answered on 14 Sep 2010, 01:46 PM
Hi,
Use Value() method:
<%= Html.Telerik().DatePickerFor(model => model.InventoryTypeTemplateInstance.ActivationDate)
.Value(Model.InventoryTypeTemplateInstance.ActivationDate == DateTime.MinValue ? null : Model.InventoryTypeTemplateInstance.ActivationDate)
Regards,
Peter
Use Value() method:
<%= Html.Telerik().DatePickerFor(model => model.InventoryTypeTemplateInstance.ActivationDate)
.Value(Model.InventoryTypeTemplateInstance.ActivationDate == DateTime.MinValue ? null : Model.InventoryTypeTemplateInstance.ActivationDate)
Regards,
Peter
0

Ratna Karthik Chandu M
Top achievements
Rank 1
answered on 14 Sep 2010, 02:00 PM
Hello Peter,
Still i am getting the default Date "1/1/0001" in Datepicker control when using like below:
<%= Html.Telerik().DatePickerFor(model => model.InventoryTypeTemplateInstance.ActivationDate)
<%= Html.Telerik().DatePickerFor(model => model.InventoryTypeTemplateInstance.ActivationDate)
.Value(Model.InventoryTypeTemplateInstance.ActivationDate == DateTime.MinValue ? new Nullable<DateTime>() : Model.InventoryTypeTemplateInstance.ActivationDate) %>
0

Samir
Top achievements
Rank 1
answered on 03 Dec 2010, 05:27 AM
Make your ActivationDate nullable DateTime?.
0

Damon
Top achievements
Rank 1
answered on 09 Mar 2012, 12:17 AM
I am having the same problem, however I don't believe it has anything to do with the Date Picker. If you look at the form post it does send the correct date to the server, but for some reason ASP.NET cannot serialize the string representation of a date into a DateTime object.
0

Adam
Top achievements
Rank 1
answered on 12 Apr 2012, 07:44 PM
Damon,
Yes, the MVC model binder won't recognize javascript dates represented as a string. Convert it before posting. See here: http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-datepicker-client-api-and-events.html#ClientMethods
Yes, the MVC model binder won't recognize javascript dates represented as a string. Convert it before posting. See here: http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-datepicker-client-api-and-events.html#ClientMethods