2013-12-20 40 views
0

我在我的模型,我需要本地化DataAnnotation使用MVC 5,使用下面的代碼如何在MVC中本地化DataAnnotation?

[Required] 
[Display(Name = Resources.Account_Login_UserName)] 
public string UserName { get; set; } 

我收到此錯誤:

An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

不知道如何解決它?

回答

3
[Display(Name = "Account_Login_UserName", ResourceType = typeof(Resources))] 
+0

感謝您的回答,我有一個類似的相關問題http://stackoverflow.com/questions/20699594/how-localize-errormessage-in-dataannotation你能幫忙嗎?謝謝 – GibboK