ConstructorNeedsTagAttribute Klasa

Definicja

Określa, że kontrolka serwera wymaga nazwy tagu w jego konstruktorze.

public ref class ConstructorNeedsTagAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class ConstructorNeedsTagAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type ConstructorNeedsTagAttribute = class
    inherit Attribute
Public NotInheritable Class ConstructorNeedsTagAttribute
Inherits Attribute
Dziedziczenie
ConstructorNeedsTagAttribute
Atrybuty

Przykłady


  // 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 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 
      {
         get 
         {
            return UserMessage;
         }
         set 
         {
            UserMessage = value;
         }
      }                

      protected override void Render(HtmlTextWriter output) 
      {
         output.Write("Testing the ConstructorNeedsTagAttribute Class.");
      }
}
' 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
  
  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
End Class

Uwagi

Aby uzyskać informacje w tle, zobacz Atrybuty.

Konstruktory

ConstructorNeedsTagAttribute()

Inicjuje nowe wystąpienie klasy ConstructorNeedsTagAttribute.

ConstructorNeedsTagAttribute(Boolean)

Inicjuje nowe wystąpienie klasy ConstructorNeedsTagAttribute.

Właściwości

NeedsTag

Wskazuje, czy kontrolka potrzebuje nazwy tagu w jego konstruktorze. Ta właściwość jest tylko do odczytu.

TypeId

Po zaimplementowaniu w klasie pochodnej pobiera unikatowy identyfikator dla tego Attributeelementu .

(Odziedziczone po Attribute)

Metody

Equals(Object)

Zwraca wartość wskazującą, czy to wystąpienie jest równe podanemu obiektowi.

(Odziedziczone po Attribute)
GetHashCode()

Zwraca wartość skrótu dla tego wystąpienia.

(Odziedziczone po Attribute)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
IsDefaultAttribute()

W przypadku zastąpienia w klasie pochodnej wskazuje, czy wartość tego wystąpienia jest wartością domyślną klasy pochodnej.

(Odziedziczone po Attribute)
Match(Object)

Po przesłonięciu w klasie pochodnej zwraca wartość wskazującą, czy to wystąpienie jest równe określonemu obiektowi.

(Odziedziczone po Attribute)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Zestaw nazw jest mapowany na odpowiedni zestaw identyfikatorów wysyłania.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Pobiera informacje o typie dla obiektu, który może służyć do pobierania informacji o typie dla interfejsu.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Pobiera informację o liczbie typów interfejsów, jakie zawiera obiekt (0 lub 1).

(Odziedziczone po Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Umożliwia dostęp do właściwości i metod udostępnianych przez obiekt.

(Odziedziczone po Attribute)

Dotyczy

Zobacz też