This is a migrated thread and some comments may be shown as answers.

Date or Time Resets

2 Answers 87 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 11 Sep 2012, 11:47 PM
So I'm using MVC3, creating a textbox for the date-time like so:

@Html.TextBoxFor(e => e.EndDtTm, new { id = "endDtTm", style = "width: 200px;" })

and in Ready creating the kendo control

$("#endDtTm").kendoDateTimePicker();

The problem I'm having is that after I load up the model the control shows the date and time correctly but if I click the time icon and pick a new time the date resets to todays date.  The opposite happens if I select the date icon and pick a new date then the time is reset to 12:00 am.

How do I prevent this from happening?

2 Answers, 1 is accepted

Sort by
0
James
Top achievements
Rank 1
answered on 11 Sep 2012, 11:57 PM
Model property is:

[DisplayName("End")]
public DateTime? EndDtTm { get; set; }
0
Georgi Krustev
Telerik team
answered on 12 Sep 2012, 10:08 AM
Hello James,

 
The DateTimePicker widget, as other date/time pickers, depends on the format and the parseFormat options in order to parse the input value. I suppose that in your case the input value does not match the default format of the DateTimePicker widget and the value of the widget is actually null. I will suggest you set the correct format/parseFormats or use the Kendo DateTimePicker wrapper for ASP.NET MVC.

All the best,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Date/Time Pickers
Asked by
James
Top achievements
Rank 1
Answers by
James
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or