Compare validation on Rad datetime picker

7 posts, 0 answers
  1. Harry
    Harry avatar
    27 posts
    Member since:
    Mar 2009

    Posted 16 Sep 2009 Link to this post

    how i can apply compare validator on RadDateTimePicker
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Sep 2009 Link to this post

    Hi Harry,

    Go through the following demo link which demonstrates how to use CompareValidator for RadDatePicker. I hope this would be helpful for you.
    Calendar / Validation

    Also checkout the documentation on this:
    Web Pages Validation

    -Shinu.
  3. Harry
    Harry avatar
    27 posts
    Member since:
    Mar 2009

    Posted 19 Sep 2009 Link to this post

    hi Shinu
    my control is RadDateTimePicker not  RadDateTime.
  4. Daniel Fell
    Daniel Fell avatar
    1 posts
    Member since:
    Feb 2010

    Posted 12 May 2010 Link to this post

    Any update on this?
  5. Dan Glascott
    Dan Glascott avatar
    3 posts
    Member since:
    Oct 2004

    Posted 25 Jun 2010 Link to this post

    yeah, any update? I just logged a help ticket for the same thing.
  6. Prasad
    Prasad avatar
    7 posts
    Member since:
    Nov 2010

    Posted 14 Dec 2010 Link to this post

    I got the same issue. compare validation is not working for RadDateTime picker
  7. Kevin Price
    Kevin Price avatar
    49 posts
    Member since:
    Sep 2012

    Posted 15 Dec 2010 Link to this post

    I resorted to doing this in javascript. I have a scheduler page set up with advanced input form, but the way the date/time are validated is the same throughout the app. This is done by getting references to the textboxes of the date/time pickers (works the same for both) - using match in this case because of UC. $find works fine when on the same page

    //Get the start date
                       $telerik.$(".rsAdvDatePicker").each(function(i) {
                           if (this.id.match("StartDate") != null) {
                               startDateBox = this.id;
                               startDateBox = startDateBox.replace('_wrapper', '');
                           }
                           if (this.id.match("RadScheduler1_Form_AdvancedInsertForm1_EndDate") != null) {
                               endDateBox = this.id;
                               endDateBox = endDateBox.replace('_wrapper', '');
     
                           }
                           if (this.id.match("RadScheduler1_Form_AdvancedEditForm1_EndDate") != null) {
                               endDateBox = this.id;
                               endDateBox = endDateBox.replace('_wrapper', '');
     
                           }
                       });
                       //Get the start time
                       $telerik.$(".rsAdvTimePicker").each(function(i) {
                           if (this.id.match("StartTime") != null) {
                               startTimeBox = this.id;
                               startTimeBox = startTimeBox.replace('_wrapper', '');
                           }
                           if (this.id.match("EndTime") != null) {
                               endTimeBox = this.id;
                               endTimeBox = endTimeBox.replace('_wrapper', '');
                           }
                       });

    Then use simple Date.parse to see what's up
    var sDt = $find(startDateBox);
                                var sTm = $find(startTimeBox);
                                var eDt = $find(endDateBox);
                                var eTm = $find(endTimeBox);
                                //check the dates first
                                if (Date.parse(sDt.get_selectedDate() + ' ' + sTm.get_selectedDate()) > Date.parse(eDt.get_selectedDate() + ' ' + eTm.get_selectedDate())) {
                                    alert("Invalid Start/End times, please make sure start time is before the end time\n" + sDt.get_selectedDate() + "\n" + eDt.get_selectedDate());
                                    return false;
                                }

    I did this for 2 reasons. 1 - Comparison validation wasn't working and 2 - I needed to perform client side functionality if they didn't match. Not sure if this is what you guys were looking for, but it is compare validation on a RadDateTime picker
Back to Top