How to replace the default ModelState error message in Asp.net MVC 2?

I don’t know about v2, but this works on v1:

  1. Add a resource file in App_GlobalResources.
  2. In the resource file you can define strings named PropertyValueInvalid and PropertyValueRequired.
  3. On the Application_Start global.asax event set System.Web.Mvc.DefaultModelBinder.ResourceClassKey = "resource file name".

Leave a Comment