Changing error message for datatype validation?
Posted
by Matthias
on Stack Overflow
See other posts from Stack Overflow
or by Matthias
Published on 2010-04-15T11:28:26Z
Indexed on
2010/04/15
11:33 UTC
Read the original article
Hit count: 425
Hey guys,
I've a small question on ASP.NET MVC 2. I'm using Data Annotations on my Presentation Model and its model binder per default. But one step back, I want to do the most elementary thing: validation of the data type.
Let's say I have an "int ID" on my model and want to edit the according entity in my view. If I enter something wrong like "foo", then I get a model error back, but the validation message is on English. I want to have this message in other languages, too. How can I do this?
I remember that in MVC 1 I've written a custom model binder which checks the data types, but that's not what I want to do (at least not in MVC 2). Thus I hope there is a better way...
Thanks, Matthias
© Stack Overflow or respective owner