Datepicker - setting selected date as current date plus 3 days

Hi,

I have a datepicker in my visual webpart.

I want to set by default as "today's date + 3 days".

Example: if today is 25 Feb, then the datepicker should have selected date as 28

I am aware of this:

DTDefaultDate.SelectedDate = DateTime.Today;

How to add the 3 days to it?

Thanks

February 25th, 2015 9:31am

Hi,

If you want to set the DateTimeControl to a specific date, please take the code below for a try:

DateTimeControl1.SelectedDate = DateTime.Today.AddDays(3);

More information about DateTime.AddDays Method:

https://msdn.microsoft.com/en-us/library/system.datetime.adddays(v=vs.110).aspx

Thanks

Patrick Liang

Forum Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

Free Windows Admin Tool Kit Click here and download it now
February 26th, 2015 6:40am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics