Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Validation doesn't work when setting ErrorMessage parameter #5

Edddy opened this Issue · 7 comments

2 participants


If you try to override the default error message the validation is skipped and always validate

public class Product {

    public String Name { get; set; }

    // this wont work
    [Required(ErrorMessage = "Other is required")]
    public String Other { get; set; }



@jgauffin jgauffin closed this

Was this fixed or it's a "Won't fix"?


@jgauffin: It's hard to be collaborative if you don't communicate with us


I'm on vacation. Will look at is as soon as I get back. I thought that I had fixed it. However it's hard to get everything working properly (1. be able to use custom validation attributes 2. use the built in attributes 3. use custom error messages in the attributes).

Microsoft hides the actual language handling inside the dataannotation attributes and then caches them in MVC3.


I understand it's hard and I can try to help you in anything you need, but we need that you coordinate the efforts. Anything from "Too hard, won't fix", "Please try to fix it yourself", or "Fixed" is good for me.

Hope you enjoy your vacations!


Should work now



How to we instanciate the providers now? This old sample code does not work now

        var stringProvider = new ResourceStringProvider(Resources.LocalizedStrings.ResourceManager);
        ModelMetadataProviders.Current = new LocalizedModelMetadataProvider(stringProvider);
        ModelValidatorProviders.Providers.Add(new LocalizedModelValidatorProvider(stringProvider));

humm. That should work. What kind of error do you get? (although I never tried with a string table only)

(you can email me at for faster responses regarding this issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.