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 ReadOnly Property NeedsTag As Boolean

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.
<ConstructorNeedsTagAttribute(True)>  _
<AspNetHostingPermission(SecurityAction.Demand, _
  Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class Simple
  Inherits WebControl

  Private NameTag As String = ""


  Public Sub New(tag As String)
     Me.NameTag = tag
  End Sub 'NewNew

  Private UserMessage As String = Nothing

  ' Create a property named ControlValue.   
  Public Property ControlValue() As [String]
     Get
        Return UserMessage
     End Get
     Set
        UserMessage = value
     End Set
  End Property

  Protected Overrides Sub Render(output As HtmlTextWriter)
     output.Write("Testing the ConstructorNeedsTagAttribute Class.")
  End Sub 'Render
End Class 'Simple

.NET Framework
Available since 1.1
Return to top
Show: