Freigeben über


ConstructorNeedsTagAttribute-Konstruktor ()

Initialisiert eine neue Instanz der ConstructorNeedsTagAttribute-Klasse.

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

Syntax

'Declaration
Public Sub New
'Usage
Dim instance As New ConstructorNeedsTagAttribute
public ConstructorNeedsTagAttribute ()
public:
ConstructorNeedsTagAttribute ()
public ConstructorNeedsTagAttribute ()
public function ConstructorNeedsTagAttribute ()

Beispiel

' Attach the ConstructorNeedsTagAttribute to the custom
' SimpleControl, which is derived from WebControl. When
' this version of the constructor is used, the NeedsTag
' property is automatically set to false; therefore,
' this class does not need a tag attribute.
<ConstructorNeedsTagAttribute()>  _
<AspNetHostingPermission(SecurityAction.Demand, _
   Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class SimpleControl
   Inherits WebControl
   
   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 'SimpleControl
 // Attach the ConstructorNeedsTagAttribute to the custom
 // SimpleControl, which is derived from WebControl. When
 // this version of the constructor is used, the NeedsTag
 // property is automatically set to false; therefore,
 // this class does not need a tag attribute.
 [ConstructorNeedsTagAttribute()] 
 [AspNetHostingPermission(SecurityAction.Demand, 
     Level=AspNetHostingPermissionLevel.Minimal)]
 public sealed class SimpleControl : WebControl 
 {
 
      private String UserMessage=null;
 
      // Create a property named ControlValue.
      public String ControlValue 
      {
         get 
         {
            return UserMessage;
         }
         set 
         {
            UserMessage = value;
         }
       }
             
      protected override void Render(HtmlTextWriter output) 
      {
        output.Write("Testing the ConstructorNeedsTagAttribute class.");

     }
}     
// Attach the ConstructorNeedsTagAttribute to the custom
// SimpleControl, which is derived from WebControl. When
// this version of the constructor is used, the NeedsTag
// property is automatically set to false; therefore,
// this class does not need a tag attribute.

/** @attribute ConstructorNeedsTagAttribute()
 */
public class SimpleControl extends WebControl
{
    private String userMessage = null;
    // Create a property named ControlValue.
    /** @property 
     */
    public String get_ControlValue()
    {
        return userMessage;
    } //get_ControlValue

    /** @property 
     */
    public void set_ControlValue(String value)
    {
        userMessage = value;
    } //set_ControlValue

    protected void Render(HtmlTextWriter output)
    {
        output.Write("Testing the ConstructorNeedsTagAttribute class.");
    } //Render
} //SimpleControl

Plattformen

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

ConstructorNeedsTagAttribute-Klasse
ConstructorNeedsTagAttribute-Member
System.Web.UI-Namespace
Attribute