How to use and/or localize DisplayAttribute with ASP.NET MVC2?
- by asp_net
I am trying to figure out how to get the DisplayAttribute in my MVC 2 ViewModel to work with the Html.LabelFor() helper.
Neither
public class TestModel
{
[Display(ResourceType = typeof(Localization.Labels))]
public string Text { get; set; }
}
nor
public class TestModel
{
[Display(Name = "test")]
public string Text { get; set; }
}
seem to work. Localizing the Required Attribute works as expected:
[Required(ErrorMessageResourceName = "Test", ErrorMessageResourceType = typeof(Localization.Labels))]
I am using VS2010 RC. Has anybody got that running?