RadCalendar Validation

2 posts, 0 answers
  1. adam
    adam avatar
    20 posts
    Member since:
    Dec 2007

    Posted 04 May 2012 Link to this post

    I can't find any examples or documentation on using asp.net validators with the RadCalendar (not the RadDatePicker).

    Ideally, I'd like to have two calendars, and use the CompareValidator to ensure that one date is less than the other. Has anyone been able to do this?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 May 2012 Link to this post

    Hello Adam,

    Since RadCalendar is not an input control, you cannot validate it directly. One approach is to access the selected date and check for the condition. Here is the sample code.
    protected void Button1_Click(object sender, EventArgs e)
      DateTime d1 = RadCalendar1.SelectedDate;
      DateTime d2 = RadCalendar2.SelectedDate;
        Response.Write("<script language=JavaScript>confirm('Please select a higher date');</script>");

Back to Top