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

DatePicker disbale backdating

4 Answers 84 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
JK
Top achievements
Rank 1
JK asked on 16 May 2008, 10:57 AM
Hi,

Can you disable dates prior todays date?  I dont wan the user being able to backdate a record.  Is this possible?

Thanks,

JK

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 16 May 2008, 01:19 PM
Hello JK,

You can use the RangeMinDate property of the calendar control to disallow selection of dates prior to a certain date. This property is exclusive so you need to set it to the day after today like this:

RadCalendar1.RangeMinDate = DateTime.Today.AddDays(1);

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JK
Top achievements
Rank 1
answered on 16 May 2008, 03:01 PM
Hi,

That controls the calendar control but how does this relate to the datepicker.  i tried a the following but didn't work:

This example is set in the page_load event and grabs hold of the control which is inside a form:
Telerik.Web.UI.RadDatePicker rdpDate = (Telerik.Web.UI.RadDatePicker)fvTest.FindControl("rdpDate");  
 
 
// The following line did not work  
rdpDate.SharedCalendar.RangeMinDate = DateTime.Today.AddDays(1);  
 
//The following line did not work  
rdpDate.Calendar.RangeMinDate = DateTime.Today.AddDays(1);  
 

Thanks,

JK

0
Konstantin Petkov
Telerik team
answered on 16 May 2008, 03:03 PM
Hi JK,

Please, get the shared calendar instance (through FindControl again if necessary) instead and let us know if that helps.

Greetings,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JK
Top achievements
Rank 1
answered on 19 May 2008, 12:16 PM
I only have the 1 datepicker on the form so I dont need a shared calendar.  the previous post was out of desperation trying to get the control to work.  I have spent a bit of time on it today and discovered this command (variation off what you supplied)

Telerik.Web.UI.

RadDatePicker rdp = (Telerik.Web.UI.RadDatePicker)formview.FindControl("datepickercontrol");

rdp.MinDate =

DateTime.Today.AddDays(1);

The above works.

Tags
Calendar
Asked by
JK
Top achievements
Rank 1
Answers by
Steve
Telerik team
JK
Top achievements
Rank 1
Konstantin Petkov
Telerik team
Share this question
or