Custom validation error message for RadDatePicker

12 posts, 0 answers
  1. Paresh Sen
    Paresh Sen avatar
    19 posts
    Member since:
    Sep 2009

    Posted 16 Oct 2009 Link to this post

    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
  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 21 Oct 2009 Link to this post

    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.
  3. DevCraft banner
  4. Paresh Sen
    Paresh Sen avatar
    19 posts
    Member since:
    Sep 2009

    Posted 21 Oct 2009 Link to this post

    Hi,

    Any sample example code will be of great help.

    Thanks,
    Paresh
  5. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 23 Oct 2009 Link to this post

    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.
  6. Paresh Sen
    Paresh Sen avatar
    19 posts
    Member since:
    Sep 2009

    Posted 23 Oct 2009 Link to this post

    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

  7. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 28 Oct 2009 Link to this post

    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.
  8. Nguyen Xuan Truong
    Nguyen  Xuan Truong avatar
    1 posts
    Member since:
    Apr 2010

    Posted 15 Apr 2010 Link to this post

    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

     

     

     

     

  9. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 20 Apr 2010 Link to this post

    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.
  10. Ph?m H?ng Van
    Ph?m H?ng Van avatar
    7 posts
    Member since:
    Jan 2010

    Posted 06 May 2010 Link to this post

    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

  11. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 11 May 2010 Link to this post

    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.
  12. Deloris
    Deloris avatar
    2 posts
    Member since:
    Jan 2015

    Posted 06 Jan 2015 in reply to Kaloyan Link to this post

    Greetings Paresh,

    Can you provide exampled for this solution you mentioned above.
    Thanks
  13. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 07 Jan 2015 Link to this post

    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.

     
Back to Top
DevCraft banner