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

Date validation for RADDatePicker control

2 Answers 364 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Sid
Top achievements
Rank 1
Sid asked on 14 Apr 2009, 02:21 AM
Hi,

I want to display a custom message when the user enters a wrong date in the RADDatePicker control.

The code is given below..
        <telerik:RadDatePicker ID="RadDatePicker1" runat="server"
        </telerik:RadDatePicker> 
        <asp:RegularExpressionValidator ID="RegularExpressionValidator1"  
            ControlToValidate="RadDatePicker1" runat="server"  
            ErrorMessage="Please enter date in dd/mm/yyyy format"  
            ValidationExpression="([1-9]|0[1-9]|[12][0-9]|3[01])[/]([1-9]|0[1-9]|1[012])[/](19|20)\d\d"></asp:RegularExpressionValidator> 
        <br /> 
 
 

This validation(dd/mm/yyyy) doesnot work with RADDatePicker.
Although, when I use the same regular expression to validate date in an asp:textbox control, it works.

Please explain...

thanks and regards,
Sid

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 15 Apr 2009, 10:32 AM
Hello Sid,

If you need to allow only particular date formats to be added in the DatePicker control you could use the RadDatePicker.DateFormat property and still use the activated inbuilt validation. Please review the following help topic for more information on this property.

Additionally, review the following live demo about RadDatePicker validation:
Calendar / Validation

Either you can use the client side onError event.

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sid
Top achievements
Rank 1
answered on 27 Apr 2009, 01:23 AM
thanks for that...
Tags
Calendar
Asked by
Sid
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Sid
Top achievements
Rank 1
Share this question
or