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

Localization of client side validation messages

1 Answer 280 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin Sall
Top achievements
Rank 1
Martin Sall asked on 13 Jan 2013, 01:24 PM
We have implemented localized validation attributes which inherit form Data Annotations attributes and pull required validation strings from resource DLLs. For example, we have [RequiredLocalized] which inherits from RequiredAttribute. Everything works fine with MVC form fields, we get translated error messages when validating client-side and server-side (when JS turned off).

But when editing field values in Kendo Grid, our own RequiredLocalized validator does not seem to work client-side - invalid data get sent to the server, then the MVC validates the model and rejects it, and only then the error is returned to client.

How do we tell Kendo Grid to use our RequiredLocalized attribute in Javascript the same way as it uses [Required] ?

Also we see that Telerik Javascript files have some hard-coded validation strings, like "must be a number". Hiow do we localize these?

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Jan 2013, 11:06 AM
Hello,

You should register an adapter for the custom attribute in order to add the unobtrusive attributes to the inputs e.g.

protected void Application_Start()
{
    DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(RequiredLocalizedAttribute), typeof(RequiredAttributeAdapter));
Kind regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Martin Sall
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or