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. Image for the cookie policy date
close icon

DatePicker loses value with server validation

In case anybody runs into this common scenario, here is the fix...

[Controller]

[HttpPost]

        public ActionResult Index(EditorValidation e)

        {

            ViewBag.Message = 'Welcome to ASP.NET MVC!';

            DatePickerModel model = new DatePickerModel();

            model.DisplayDefaultDateOnLoad = true;

            ViewData["datemodel"] = model;

            return View();

        }

[View]

@Html.Syncfusion().DatePickerFor(model => model.DateTimeValue, (DatePickerModel)ViewData["datemodel"])



2 Replies

JH John Hind May 24, 2013 10:44 AM UTC

It should be set to true by default anyway. I spent many hours trying to make it work until I found this setting. It is more likely that you would want it to be set to true. Come on Syncfusion !



VR Varalakshmi R.S Syncfusion Team May 30, 2013 04:04 AM UTC

Hi John,

 

Thanks for sharing the details with us.

 

Kindly get back to us if you have any other queries.

 

Regards,

Varalakshmi

Loader.
Live Chat Icon For mobile
Up arrow icon