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

Custom validation error message for RadDatePicker

11 Answers 532 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Paresh Sen
Top achievements
Rank 1
Paresh Sen asked on 16 Oct 2009, 07:08 AM
Hi,

I'm using RadDatePicker.
By default on validation error (if wrong entry is made) it displays error "Can't convert null to type System.DateTime" and the box shows "Input is not in correct format".

Is there a way I can modify these messages.


Any help will be appreciated.

Thanks,
Paresh

11 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 21 Oct 2009, 02:40 PM
Hi Paresh Sen,

The easiest way to achieve this is to create a MVVM model which is bound to the RadDatePicker. In case of wrong typed date you can catch in your view model class and throw the message you desire. Let us know if you need any further information or examples.

Kind regards,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Paresh Sen
Top achievements
Rank 1
answered on 21 Oct 2009, 02:46 PM
Hi,

Any sample example code will be of great help.

Thanks,
Paresh
0
Kaloyan
Telerik team
answered on 23 Oct 2009, 12:07 PM
Hello Paresh Sen,

Sorry for the late response. You can find an example in our online demos  showing how to validate a RadDatePicker. Let us know if it helps you.

Greetings,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Paresh Sen
Top achievements
Rank 1
answered on 23 Oct 2009, 01:38 PM

Hi,

The demo in site doesn't implement custom validation. Please find the screen shot attached.
Any implementation with custom error string as output will be of great help.

Thanks,
Paresh

0
Kaloyan
Telerik team
answered on 28 Oct 2009, 12:56 PM
Hello Paresh Sen,

The given example is demonstrating the way  how to implement a custom validation as there is no other way. The message which you are getting is not hard coded in the control so there is not possibility override the message. The idea of Silverlight validation system (when your control is date bound to some object), is when some property meets a not desire value, you can throw an exception so the Silverlight runtime will catch it and then display he desired result. Attached you can find an example of how you can implement a sort of custom exception. Hope it will help you for your case.

Kind regards,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Nguyen Xuan Truong
Top achievements
Rank 1
answered on 15 Apr 2010, 10:17 AM
Hello Kaloyan

I have the same issue when using RadDatePicker , when I enter nothing into RadDatePicker (clear content of RadDatePicker  ) , an error message "Input is not in correct format" will  be displayed . The  RadDatePicker  is bound to the field  "FromDate ", in metadata 

Public
 FromDate As DateTime 

And in database  the type of this field is date , not allow null .
Is there any way to turn off the message  or  how can I localize the error message  ?
It's great if we can localize the message.
Thanks in advance

 

 

 

 

0
Kaloyan
Telerik team
answered on 20 Apr 2010, 02:42 PM
Hi Nguyen Xuan Truong,

See the attached application. It may help you to find a way to change the massage to the desire one. In case you want to remove it you have to modify the template of the control. Just remove the Validation tooltip control.

Greetings,
Kaloyan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ph?m H?ng Van
Top achievements
Rank 1
answered on 06 May 2010, 05:18 PM

Hi,

I have problem like Nguyen Xuan Truong 's problem when I use RadDatePicker approaching MVVM pattern and WCF RIAServices.
I tried to bug by using converter or bug in generate code or bug in line of code firing event BindingValidationError ... but I have not known when a RadDatePicker control throw exception with ErrorContent ="Input is not in correct format" .  I think that "throw exception"  occurs before firing event BindingValidationError.
You can post a sample example resolve it.

Thanks!

Pham Hong Van

0
Kaloyan
Telerik team
answered on 11 May 2010, 09:21 AM
Hi van pham hong,

The RadDatePicker is parsing its value after loosing its focus. In case of an invalid input(when null) the validation is throwing an exception. When using a MVVM pattern you can specify the validation tooltip content that will be displayed to the user. What is the scenario you want to be achieved?

Best wishes,
Kaloyan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Deloris
Top achievements
Rank 1
answered on 06 Jan 2015, 03:14 PM
Greetings Paresh,

Can you provide exampled for this solution you mentioned above.
Thanks
0
Kalin
Telerik team
answered on 07 Jan 2015, 08:42 AM
Hi Deloris,

What I can suggest you would be to check the following example from our online Silverlight demos:

http://demos.telerik.com/silverlight/#DateTimePicker/Validation

In the ValidationViewModel class you can see how the different error messages are returned.

Hope this helps.

Regards,
Kalin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
DatePicker
Asked by
Paresh Sen
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Paresh Sen
Top achievements
Rank 1
Nguyen Xuan Truong
Top achievements
Rank 1
Ph?m H?ng Van
Top achievements
Rank 1
Deloris
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or