This documentation is archived and is not being maintained.

ConstructorNeedsTagAttribute.NeedsTag Property

Indicates whether a control needs a tag name in its constructor. This property is read-only.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public bool NeedsTag { get; }

Property Value

Type: System.Boolean
true if the control needs a tag in its constructor. The default is false.

  // Attach the ConstructorNeedsTagAttribute to the custom Simple
  // class, which is derived from the WebControl class. This 
  // instance of the ConstructorNeedsTagAttribute class sets the
  // NeedsTag property to true.
  public sealed class Simple : WebControl 
     private String NameTag = "";

     public Simple(String tag)
            this.NameTag = tag;

      private String   UserMessage = null;

      // Create a property named ControlValue.
      public String ControlValue 
            return UserMessage;
            UserMessage = value;

      protected override void Render(HtmlTextWriter output) 
         output.Write("Testing the ConstructorNeedsTagAttribute Class.");

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.