DataAnnotations and Resources don't play nicely
Posted
by devlife
on Stack Overflow
See other posts from Stack Overflow
or by devlife
Published on 2010-03-15T23:19:07Z
Indexed on
2010/03/15
23:19 UTC
Read the original article
Hit count: 525
I'm using dataannotations in an MVC2 app and am a little discouraged when trying to use RESX file resources for error messages.
I've tried the following but keep getting the exception "An attribute
[Required(ErrorMessage = Resources.ErrorMessages.Required)]
[Required(ErrorMessageResourceName = Resources.ErrorMessages.Required, ErrorMessageResourceType = typof(Resources.ErrorMessages)]
I keep getting that error message unless I replace ErrorMessageResourceName with "Required" instead of Resources.ErrorMessages.Required.
Can anyone tell me if I'm doing this right?
© Stack Overflow or respective owner