Hi I've been trying to change the validation error messages (in MVC3) and read a lot of threads and find out from this thread:
- Create App_GlobalResources folder for your project (right click to
project -> Add -> Add ASP.NET folder -> App_GlobalResources). - Add a resx file in that folder. Say MyNewResource.resx.
- Add resource key PropertyValueInvalid with the desired message format (e.g. "content {0} is invalid for field {1}"). If you want to change PropertyValueRequired too add it as well.
- Add the code DefaultModelBinder.ResourceClassKey = "MyNewResource" to your Global.asax startup code.
But I cannot make it work. Here is a clean MVC 3 web application I want to change the validation messages. Please make it work for me as and as a sample for everybody else.
here is the link for my test project