Reputation: 73928
I am using MVC 5 in my Model I need to localize DataAnnotation, using the following code
[Required]
[Display(Name = Resources.Account_Login_UserName)]
public string UserName { get; set; }
I receive this error:
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
Any idea how to fix it?
Upvotes: 1
Views: 284
Reputation: 21337
[Display(Name = "Account_Login_UserName", ResourceType = typeof(Resources))]
Upvotes: 3