Changing the error message for data type authentication?

I have a small question on ASP.NET MVC 2. I am using data annotations for my view model and its default model bindings. But one step back, I want to do the most basic thing: data type checking.

Let's say I have an "int ID" on my model and you want to edit the corresponding entity in my opinion. If I enter something wrong like "foo" then I get a model error, but the validation message is in English. I want to have this message in other languages ​​as well. How can i do this?

I remember that in MVC 1 I wrote my own nexus that validates data types, but that is not what I want to do (at least not in MVC 2). So I hope there is a better way ...

Thanks Matthias

+2


a source to share


2 answers


Model validation using localization



http://helios.ca/2010/02/17/asp-net-mvc-2-model-validation-with-localization/

0


a source


Look for the solution at the end of this page:

http://jwwishart.wordpress.com/2010/03/22/custom-server-and-client-side-required-validator-in-mvc-2-using-jquery-validate/



I tested this in my RTM MVC 3 project and it works well.

0


a source







All Articles