I would like to build an extended DisplayAttribute annotation that can detect if the property has the required attribute on it. And, if so and a “* ” in front of the name to show it is required.
Is this possible? I can’t seem to figure out how to discover if other attributes are present within an attribute. Even if it is possible, will the Html.Label helper recognize it? Or do I have to extend that as well?
Writing a custom
Html.LabelForwill be enough. You don’t need to extend theDisplayAttributeas you cannot access other attributes from within an attribute.