With Data Annotations for example, besides decorating members like this:
[Required(
ErrorMessage = "You must enter your first name."
)]
public int FirstName { get; set; }
I can also do it like this to accommodate multiple cultures:
[Require开发者_如何转开发d(
ErrorMessageResourceType = typeof(Resources.Customer),
ErrorMessageResourceName = "NameRequired"
)]
public int FirstName { get; set; }
Does anybody know if the input builders in MVC Contrib support something like this for setting labels?
Thank you.
In MVC 2 do you have an attribute called DisplayName
. DisplayNameAttribute
doesn't support localization out of the box, but you can derived it and implement it yourself.
Here is an example how to do that: http://adamyan.blogspot.com/2010/02/aspnet-mvc-2-localization-complete.html
精彩评论