In MVC 2, how to annotate a class for an UI Helper Template (not a property)?

annotations, asp.net-mvc, ui-helper

Solution

Make a template with the name of the class, and it just works.

Problem

I know this works for single properties as per Scott Guthrie's blog to auto-magically use a partial view to render a partial model passed to it (UI Helper like in dynamic data): ``` [UIHint("StateDropDown")] public string State { get; set;} ``` But how do you annotate an entire class to use an UI helper like this: ``` [UIHint("Address")] public class Address { public string addr1 { get; set; } public string addr2 { get; set; } public string city { get; set; } [UIHint("StateDropDown")] public string state { get; set; } public string zip { get; set; } } ``` (Except [UIHint("Address")] doesn't seem to work on classes. I see in his examples, he has "Customer.aspx" in the Shared->EditorTemplates folder, so I assume this is possible.

Original source