Why can't I use resources as ErrorMessage with DataAnnotations?
Posted
by Jova
on Stack Overflow
See other posts from Stack Overflow
or by Jova
Published on 2010-04-22T07:17:58Z
Indexed on
2010/04/22
8:03 UTC
Read the original article
Hit count: 309
Why can't I do like this?
[Required(ErrorMessage = "*")]
[RegularExpression("^[a-zA-Z0-9_]*$", ErrorMessage = Resources.RegistrationModel.UsernameError)]
public string Username { get; set; }
What is the error message telling me?
An attribute argument must be a constant expression , typeof expression or array creation expression of an attribute parameter type.
© Stack Overflow or respective owner