开发者

Can a data annotation discover other annotations?

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 t开发者_C百科o 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.LabelFor will be enough. You don't need to extend the DisplayAttribute as you cannot access other attributes from within an attribute.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜