Feature Date Validation For RadDatePicker

2 posts, 0 answers
  1. Kaushal
    Kaushal avatar
    35 posts
    Member since:
    Oct 2010

    Posted 01 Nov 2011 Link to this post

    Hello ALL,

    I have used RadDatePicker into my web page, Now i want to restrict feature date selection to user.

    So i had set the max date property as today's date from code behind.it's working properly, user can't able to select feature date from calender.

    In case if user try to add feature date manually, then date picker highlighted with warning symbol with yellow color.

    But when i click on save button and checked Page.IsValid property, it will always give me true and i got the date picker selected value as null.

    How can i validate RadDatePicker for feature date? Please help me.

    Here is my code :

    aspx :
      <telerik:RadDatePicker ID="dpCompletedDate" Calendar-ShowRowHeaders="false"
                                        Skin="Office2007" runat="server"  />

    Page Load cs :
    dpCompletedDate.MaxDate = System.DateTime.Now;

  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 01 Nov 2011 Link to this post

    Hello Kaushal,

    The RadDatePicker validation doesn't use any validators to prevent a postback from happening. You need to use a CompareValidator, to prevent a postback from happening by comparing it to the MaxDate you used in your RadDatePicker.

    I hope that helps.
Back to Top