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

Compare validation on Rad datetime picker

6 Answers 532 Views
Input
This is a migrated thread and some comments may be shown as answers.
Harry
Top achievements
Rank 1
Harry asked on 16 Sep 2009, 01:22 PM
how i can apply compare validator on RadDateTimePicker

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Sep 2009, 04:31 AM
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.
0
Harry
Top achievements
Rank 1
answered on 19 Sep 2009, 07:13 AM
hi Shinu
my control is RadDateTimePicker not  RadDateTime.
0
Daniel Fell
Top achievements
Rank 1
answered on 12 May 2010, 06:51 PM
Any update on this?
0
Dan Glascott
Top achievements
Rank 1
answered on 26 Jun 2010, 12:02 AM
yeah, any update? I just logged a help ticket for the same thing.
0
Prasad
Top achievements
Rank 1
answered on 14 Dec 2010, 08:29 PM
I got the same issue. compare validation is not working for RadDateTime picker
0
Kevin Price
Top achievements
Rank 1
answered on 15 Dec 2010, 08:50 PM
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
Tags
Input
Asked by
Harry
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Harry
Top achievements
Rank 1
Daniel Fell
Top achievements
Rank 1
Dan Glascott
Top achievements
Rank 1
Prasad
Top achievements
Rank 1
Kevin Price
Top achievements
Rank 1
Share this question
or