DatePicker disbale backdating

5 posts, 0 answers
  1. JK
    JK avatar
    123 posts
    Member since:
    Sep 2007

    Posted 16 May 2008 Link to this post

    Hi,

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

    Thanks,

    JK
  2. Steve
    Admin
    Steve avatar
    10940 posts

    Posted 16 May 2008 Link to this post

    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
  3. JK
    JK avatar
    123 posts
    Member since:
    Sep 2007

    Posted 16 May 2008 Link to this post

    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

  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 16 May 2008 Link to this post

    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
  5. JK
    JK avatar
    123 posts
    Member since:
    Sep 2007

    Posted 19 May 2008 Link to this post

    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.

Back to Top