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

How to set the start date of datepicker.

Hi,
 
I am unable to set the start date of datepicker in syncfusion.
Could you help me to set the start date of datepicker from the model in mvc using razor.
 
Thanks in advance.
 

 


1 Reply

ME Meena Syncfusion Team February 20, 2013 12:13 PM UTC

Hi Devendar,

 

Thanks for contacting Syncfusion forums.

 

Your requirement setting the start date in Datepicker can be achieved using MinDate property of the control. Please refer the below code snippet.

 

<code>

        public ActionResult Index()

        {

            DatePickerModel model = new DatePickerModel();

           

            //To set the start date                                     // You can also set the date like this         

            model.MinDate = DateTime.Today.Date;                        model.MinDate = new DateTime(2013, 01, 10);

 

            //To set the end date

            model.MaxDate = DateTime.Now.AddMonths(5);                  model.MaxDate = new DateTime(2013, 12, 10);

                    

            // To set the deafult date

            model.DefaultDate = new DateTime(2013, 02, 20);

            model.DisplayDefaultDateOnLoad = true;

 

            ViewData["date"] = model;

            return View();

        }

 

 

</code>

 

We have also prepared a simple sample for your convenience and it can be downloaded from the below link.

 

Kindly have a look at the sample and let us know if it helps.

 

Regards,

Meena



Datepicker_TestSample_fa461af1.zip

Loader.
Live Chat Icon For mobile
Up arrow icon