我遵循Scott Gu的技术ASP.NET MVC 2:Model Validation。 (http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx)。ASP.NET MVC验证 - 错误字符串的本地化
但是我建立了一个本地化的网站。我怎样才能本地化错误字符串?
我试图通过更换以下以下:
[RegularExpression(@"\d{4}",ErrorMessage="Must be a 4 digit year")]
public Nullable<int> YearOfWork { get; set; }
下列要求:
[RegularExpression(@"\d{4}",ErrorMessage=Resources.SharedStrings.search_error1)]
public Nullable<int> YearOfWork { get; set; }
但我得到一个错误complilation:
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
请帮帮忙!
+1用于打扰发布答案 – 2010-04-14 14:34:08