5 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 15 Dec 2010, 10:48 AM
Hello Prasad,
I am not sure about your issue. Here is the code that I tried and it worked for me.
ASPX:
Please paste your code if it doesn't help.
Thanks,
Princy.
I am not sure about your issue. Here is the code that I tried and it worked for me.
ASPX:
<
telerik:RadDateTimePicker
ID
=
"RadDateTimePicker1"
runat
=
"server"
Skin
=
"Windows7"
>
</
telerik:RadDateTimePicker
>
<
telerik:RadDateTimePicker
ID
=
"RadDateTimePicker2"
runat
=
"server"
Skin
=
"Windows7"
>
</
telerik:RadDateTimePicker
>
<
asp:CompareValidator
ID
=
"CompareValidator1"
runat
=
"server"
ControlToCompare
=
"RadDateTimePicker1"
EnableClientScript
=
"true"
ControlToValidate
=
"RadDateTimePicker2"
ErrorMessage
=
"GreaterThan"
Type
=
"String"
Operator
=
"Equal"
>
</
asp:CompareValidator
>
Please paste your code if it doesn't help.
Thanks,
Princy.
0

Andrew Dixon
Top achievements
Rank 1
answered on 17 Dec 2010, 04:29 AM
I'm having the same problem. I recently change from using RadDatePicker to RadDateTimePicker and my compare validator has stopped working.
I've also tried a CustomValidator and had no luck with that either.
Thanks
Andrew
<
telerik:RadDateTimePicker
ID
=
"rdtp_Start"
runat
=
"server"
Width
=
"200px"
>
<
DateInput
ID
=
"DateInput3"
runat
=
"server"
DateFormat="<%$ Resources:Globals, DATETIME_FORMAT %>" DisplayDateFormat="<%$ Resources:Globals, DATETIME_FORMAT %>" ></
DateInput
>
<
TimeView
ID
=
"TimeView2"
runat
=
"server"
StartTime
=
"00:00:00"
Interval
=
"00:30:00"
EndTime
=
"23:45:00"
Columns
=
"4"
RenderDirection
=
"Vertical"
/>
</
telerik:RadDateTimePicker
>
<
asp:RequiredFieldValidator
ID
=
"rfv_Start"
runat
=
"server"
ErrorMessage
=
"Please select a start date"
ControlToValidate
=
"rdtp_Start"
></
asp:RequiredFieldValidator
>
<
telerik:RadDateTimePicker
ID
=
"rdtp_End"
runat
=
"server"
Width
=
"200px"
>
<
DateInput
ID
=
"DateInput1"
runat
=
"server"
DateFormat="<%$ Resources:Globals, DATETIME_FORMAT %>" DisplayDateFormat="<%$ Resources:Globals, DATETIME_FORMAT %>" ></
DateInput
>
<
TimeView
ID
=
"TimeView1"
runat
=
"server"
StartTime
=
"00:00:00"
Interval
=
"00:30:00"
EndTime
=
"23:45:00"
Columns
=
"4"
RenderDirection
=
"Vertical"
/>
</
telerik:RadDateTimePicker
>
<
asp:RequiredFieldValidator
ID
=
"rfv_End"
runat
=
"server"
ErrorMessage
=
"Please select an end date"
ControlToValidate
=
"rdtp_End"
></
asp:RequiredFieldValidator
>
<
asp:CompareValidator
ID
=
"cv_End"
runat
=
"server"
ErrorMessage
=
"End date must be after start date"
EnableClientScript
=
"true"
ControlToValidate
=
"rdtp_End"
ControlToCompare
=
"rdtp_Start"
Type
=
"Date"
Operator
=
"GreaterThan"
></
asp:CompareValidator
>
I've also tried a CustomValidator and had no luck with that either.
Thanks
Andrew
0
Hello Prasad,
the Telerik team
The RadDateTimePicker could not be correctly validated with Compare Validator due to the structure of the control. In order to handle the required functionality you should use Custom Validator. Please find attached a sample application which demonstrates this scenario.
Regards,
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

TheJGV
Top achievements
Rank 1
answered on 17 Jan 2013, 02:53 AM
Can RadDateTimePicker work with RangeValidator in order to validate MinDate and MaxDate values to RadDateTimePicker?
Can you please provide some example?
Thank you
juve
Can you please provide some example?
Thank you
juve
0

Princy
Top achievements
Rank 2
answered on 17 Jan 2013, 04:50 AM
Hi,
With reference to this forum thread, Besides the visible input field that the user can type into, the RadDatePicker registers a hidden input field that is used for validation by the respective validation controls. When you set MinDate / MaxDate for the datepicker control and enter an invalid date (out-of-range), you can still see the erroneous output in the visible input field but the validation field (used by the validator controls) remains empty (after all there is NO valid selected date at the moment). Therefore RangeValidator is not activated as the only control that validates empty string is the RequiredFieldValidator.
Thanks,
Princy
With reference to this forum thread, Besides the visible input field that the user can type into, the RadDatePicker registers a hidden input field that is used for validation by the respective validation controls. When you set MinDate / MaxDate for the datepicker control and enter an invalid date (out-of-range), you can still see the erroneous output in the visible input field but the validation field (used by the validator controls) remains empty (after all there is NO valid selected date at the moment). Therefore RangeValidator is not activated as the only control that validates empty string is the RequiredFieldValidator.
Thanks,
Princy