We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DateTimePickerFor not picking up Model data

Thread ID:





118212 Feb 11,2015 08:45 PM UTC Feb 13,2015 06:46 AM UTC ASP.NET MVC 2
Tags: DateTimePicker
Marcos Romero
Asked On February 11, 2015 08:45 PM UTC

So, in my view I'm running the following line:

@Html.EJ().DateTimePickerFor(model => model.outage_start)

However it defaults to today's date no matter what I try. 

I know that the data is fine because if I use a standard editorfor it works fine:

 @Html.EditorFor(model => model.outage_start)

Any reason why this isn't working? 

Ultimately I'd like to have a datetimepicker that worked something like this:

@Html.EJ().DateTimePickerFor(model => model.outage_start).MinDateTime(Model.outage_start.ToString()).MaxDateTime(Model.outage_end.ToString())


Marcos Romero
Replied On February 11, 2015 11:23 PM UTC

I solved this by explicitly stating the datetime format. So that it has to be MM/dd/yyy hh:mm tt

That worked. Not very user friendly and in fact your example doesn't even work as the min start time does not have a space before the AM. / Thank goodness as this led me to finding a resolution. 

@Html.EJ().DateTimePicker("DateTime").MinDateTime("05/23/2014 09:00AM").MaxDateTime("05/29/2014 09:00 PM").Interval(30)

Should be:
@Html.EJ().DateTimePicker("DateTime").MinDateTime("05/23/2014 09:00 AM").MaxDateTime("05/29/2014 09:00 PM").Interval(30)

My full statement in case anyone else runs into this problem is:
@Html.EJ().DateTimePickerFor(model => model.outage_start).Width("300").MinDateTime(Model.outage_start.Value.ToString("MM/dd/yyyy hh:mm tt")).MaxDateTime(Model.outage_end.Value.ToString("MM/dd/yyyy hh:mm tt")).Value(Model.outage_start.Value.ToString("MM/dd/yyyy hh:mm tt")).Interval(1)

Kaliswaran Shanmuga Sundaram [Syncfusion]
Replied On February 13, 2015 06:46 AM UTC

Hi Marcos,


We have logged a task to achieve your requirement. A support incident to track the status of this requirement has been created under your account. Please log on to our support website to check for further updates.


Please let me know if you have any questions.


Kaliswaran S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon