Mario Turcotte
Top achievements
Rank 1
Mario Turcotte
asked on 22 Jul 2008, 02:46 PM
Hello, hope someone can help me find a decent soultion to my problem. I have a form with 4 different radDateTimePicker, they are used to create an event. For each entry I have to compare the Date and time of the previous entry. Because of the control format Compare Validator doesn't work.
I'm using radCalendar 2.2.5
Description of the 4 Date Time Pickers
1) Date that the Event will be published (today and future date)
2) Date the Event Start (GreaterThenEqual then #1 Date time Picker)
3) Date the Event End (GreatherThen then #2 Date Time Picker)
4) Date the Event is Archived (GreatherThen #3 Date Time Picker)
I've thought of using two different controls radDatePicker and radTimePicker, but I will have to add too much client side to the form. My form already have over 60 controls.
Any help suggestion is welcome.
Thanks, Mario
I'm using radCalendar 2.2.5
Description of the 4 Date Time Pickers
1) Date that the Event will be published (today and future date)
2) Date the Event Start (GreaterThenEqual then #1 Date time Picker)
3) Date the Event End (GreatherThen then #2 Date Time Picker)
4) Date the Event is Archived (GreatherThen #3 Date Time Picker)
I've thought of using two different controls radDatePicker and radTimePicker, but I will have to add too much client side to the form. My form already have over 60 controls.
Any help suggestion is welcome.
Thanks, Mario
5 Answers, 1 is accepted
0
Hello Mario,
You can use a CompareValidator to ensure that the second date is greater than the first one. This online example shows how to use CompareValidator with RadDatePicker/RadDateTimePicker control
Sincerely yours,
Plamen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can use a CompareValidator to ensure that the second date is greater than the first one. This online example shows how to use CompareValidator with RadDatePicker/RadDateTimePicker control
Sincerely yours,
Plamen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Marino
Top achievements
Rank 1
answered on 07 Aug 2008, 05:35 PM
I'm using telerik:RadDateTimePicker and the CompareValidator doesn't work with this control.
I copy the validator code from example and it doesn't work.
How can I compare two RadDateTimePicker fields ?
I copy the validator code from example and it doesn't work.
How can I compare two RadDateTimePicker fields ?
0
Hello Marino,
Can you please share your markup? We will review it and get back with our findings.
Sincerely yours,
Konstantin Petkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Can you please share your markup? We will review it and get back with our findings.
Sincerely yours,
Konstantin Petkov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Marino
Top achievements
Rank 1
answered on 08 Aug 2008, 11:30 AM
Thank you for reply.
I make some tests and detect that CompareValidator doesn't work with date and time. It only works with date.
To compare dateTime I need to use the CustomValidator and write a javascript function to validate the fields.
[]'s
Marino Mena
I make some tests and detect that CompareValidator doesn't work with date and time. It only works with date.
To compare dateTime I need to use the CustomValidator and write a javascript function to validate the fields.
[]'s
Marino Mena
0
Mario Turcotte
Top achievements
Rank 1
answered on 08 Aug 2008, 01:31 PM
@Plamen, thans for your reply, however the link you direct me on is using Date Picker only, which has never been an issue for me.
I work with the Telerik objects since two years now, and I found that sometimes objects didn't react as expected. Most of the time I had to start to play with the object on a blank page and voila! it works on my original page. It has to do with versionning I guess, since I work in an environment where two to 5 developpers are working on the same project and someone update an object. We are using Source Safe for the past 12 years and honestly I start to dislike it. Anyhow here is the code I finally came with, pretty straight forward.
<rad:RadDateTimePicker ID="rdDateTimeOccurrence" runat="server" Skin="Default" Width="175"></rad:RadDateTimePicker> |
<rad:RadDateTimePicker ID="rdDateTimeDiscovery" runat="server" Skin="Default"></rad:RadDateTimePicker> |
<rad:RadDateTimePicker ID="rdDateTimeStopped" runat="server" Skin="Default"></rad:RadDateTimePicker> |
<rad:RadDateTimePicker ID="rdDateTimeCleanedUp" runat="server" Skin="Default"></rad:RadDateTimePicker> |
<asp:RequiredFieldValidator ID="valDateTimeOccurrence" runat="server" ControlToValidate="rdDateTimeOccurrence" Display="None" ErrorMessage="Error Message"></asp:RequiredFieldValidator> |
<asp:RequiredFieldValidator ID="valDateTimeDiscovery" runat="server" ControlToValidate="rdDateTimeDiscovery" Display="None" ErrorMessage="Error Message"></asp:RequiredFieldValidator> |
<asp:CompareValidator ID="valDateTimeOccurrenceDiscovery" runat="server" ControlToCompare="rdDateTimeOccurrence" ControlToValidate="rdDateTimeDiscovery" Operator="GreaterThanEqual" Display="None" ErrorMessage="Error Message"></asp:CompareValidator> |
<asp:RequiredFieldValidator ID="valDateTimeStopped" runat="server" ControlToValidate="rdDateTimeStopped" Display="None" ErrorMessage="Error Message"></asp:RequiredFieldValidator> |
<asp:CompareValidator ID="valDateTimeDiscoveryStopped" runat="server" ControlToCompare="rdDateTimeDiscovery" ControlToValidate="rdDateTimeStopped" Operator="GreaterThanEqual" Display="None" ErrorMessage="Error Message"></asp:CompareValidator> |
<asp:RequiredFieldValidator ID="valDateTimeCleanedUp" runat="server" ControlToValidate="rdDateTimeCleanedUp" Display="None" ErrorMessage="Error Message"></asp:RequiredFieldValidator> |
<asp:CompareValidator ID="valDateTimeStoppedCleanedUp" runat="server" ControlToCompare="rdDateTimeStopped" ControlToValidate="rdDateTimeCleanedUp" Operator="GreaterThanEqual" Display="None" ErrorMessage="Error Message"></asp:CompareValidator> |
<asp:RequiredFieldValidator ID="valReportedby" runat="server" ErrorMessage="Error Message" ControlToValidate="txtReportedby" Display="None"></asp:RequiredFieldValidator> |
<asp:RequiredFieldValidator ID="valPhoneNumber" runat="server" ErrorMessage="Error Message" ControlToValidate="txtPhoneNumber" Display="None"></asp:RequiredFieldValidator> |
Each Date/Time entry is required and the following Date/Time is compare to the previous Date/Time. It works like a charm now :) This is with Version 2.2.5.