Flag control properties as required in design view

前端 未结 2 1142
独厮守ぢ
独厮守ぢ 2021-01-23 02:24

I\'d like to force the consumer of a control to give a property a value when placing the control on a page.

In VisualStudio when you create an < img > tag without att

相关标签:
2条回答
  • 2021-01-23 03:03

    You could use the Microsoft.Build.Framework.Required attribute. This would require a value to be set at build time or the build will fail with a message which indicates that the property does not have a value.

    I don't believe there is an attribute to indicate that a specific tag must be included in a server control (or at least I don't see any such attribute on the System.Web.UI.HtmlControl.Image class). I believe that the litle underlines are part of the HTML validation of the IDE.

    You could always create a custom attribute which throws a warning if a property is missing

    0 讨论(0)
  • 2021-01-23 03:20

    While Microsoft.Build.Framework.Required is probably the best answer here, for others who stumble upon this and can't use .NET 4.0, you can also use this method:

    http://forums.asp.net/t/1238319.aspx

    0 讨论(0)
提交回复
热议问题