IDReferencePropertyAttribute Konstruktorer

Definition

Initierar en ny instans av IDReferencePropertyAttribute klassen.

Överlagringar

Name Description
IDReferencePropertyAttribute()

Initierar en ny instans av IDReferencePropertyAttribute klassen.

IDReferencePropertyAttribute(Type)

Initierar en ny instans av IDReferencePropertyAttribute klassen med den angivna typen.

IDReferencePropertyAttribute()

Initierar en ny instans av IDReferencePropertyAttribute klassen.

public:
 IDReferencePropertyAttribute();
public IDReferencePropertyAttribute();
Public Sub New ()

Exempel

Följande kodexempel visar hur IDReferencePropertyAttribute attributet tillämpas på en egenskap som utvärderas till en sträng. I det här exemplet DataSourceID identifierar medlemmen en datakällakontroll vid körning. Med hjälp av den parameterlösa konstruktorn ReferencedControlType anges egenskapen till standardvärdet , Control.

// This class implements a custom data source control.
public class SomeDataBoundControl : DataBoundControl
{
    [ IDReferencePropertyAttribute() ]        
    new public string DataSourceID {
        get {
            return base.DataSourceID;
        }
        set {
            base.DataSourceID = value;
        }
    }
}
' This class implements a custom data source control.
Public Class SomeDataBoundControl
    Inherits DataBoundControl
    
    <IDReferencePropertyAttribute()>  _
    Public Shadows Property DataSourceID() As String 
        Get
            Return MyBase.DataSourceID
        End Get
        Set
            MyBase.DataSourceID = value
        End Set
    End Property
    
End Class

Kommentarer

När du anropar den här konstruktorn ReferencedControlType är egenskapen inställd på Control, vilket är dess standardvärde.

Se även

Gäller för

IDReferencePropertyAttribute(Type)

Initierar en ny instans av IDReferencePropertyAttribute klassen med den angivna typen.

public:
 IDReferencePropertyAttribute(Type ^ referencedControlType);
public IDReferencePropertyAttribute(Type referencedControlType);
new System.Web.UI.IDReferencePropertyAttribute : Type -> System.Web.UI.IDReferencePropertyAttribute
Public Sub New (referencedControlType As Type)

Parametrar

referencedControlType
Type

En Type som anger vilken typ av kontroll som representeras av egenskapen som IDReferencePropertyAttribute tillämpas på.

Exempel

Följande kodexempel visar hur IDReferencePropertyAttribute attributet tillämpas på en egenskap som utvärderas till en sträng. I det här exemplet DataSourceID identifierar medlemmen en datakällakontroll och anger DataSourceControl därför typen.

// This class implements a custom data source control.
public class SomeDataBoundControl : DataBoundControl
{   
    [ IDReferencePropertyAttribute(typeof(DataSourceControl)) ]        
    new public string DataSourceID {
        get {
            return base.DataSourceID;
        }
        set {
            base.DataSourceID = value;
        }
    }
}
' This class implements a custom data source control.
Public Class SomeDataBoundControl
    Inherits DataBoundControl
    
    <IDReferencePropertyAttribute(GetType(DataSourceControl))>  _
    Public Shadows Property DataSourceID() As String 
        Get
            Return MyBase.DataSourceID
        End Get
        Set
            MyBase.DataSourceID = value
        End Set
    End Property
    
End Class

Se även

Gäller för