Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Language specific error message for the Range attribute



I have declared a property that has an allowed range from 1 to 15. I would like to have a language specific error message but it fails the way I have done it... (I have declared the "/errormessages/invalidrange" in EditorHints.xml where I have also declared other error messages for the RegularExpression attribute which are working fine):    

    [Range(1, 15, ErrorMessage = "/errormessages/invalidrange")]
        GroupName = SystemTabNames.Content,
        Order = 110)]
    public virtual int NumberOfArticles { get; set; }

Any suggestions?

Jul 08, 2013 14:19

I'm not sure and haven't investigated further why message localization of MVC model attributes didn't work at all locally but I came up with a solution where a message is looked up at runtime, + added support for unobtrusive client-side validation (probably a bit overkill as built-in support has to work..).

More details here:

I haven't had chance to dig into - but if you resolve - please give a hint :)

Jul 08, 2013 20:29
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.