Sdílet prostřednictvím


IDReferencePropertyAttribute Konstruktory

Definice

Inicializuje novou instanci IDReferencePropertyAttribute třídy.

Přetížení

IDReferencePropertyAttribute()

Inicializuje novou instanci IDReferencePropertyAttribute třídy.

IDReferencePropertyAttribute(Type)

Inicializuje novou instanci IDReferencePropertyAttribute třídy pomocí zadaného typu.

IDReferencePropertyAttribute()

Inicializuje novou instanci IDReferencePropertyAttribute třídy.

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

Příklady

Následující příklad kódu ukazuje, jak IDReferencePropertyAttribute se atribut použije na vlastnost, která se vyhodnotí jako řetězec. V tomto příkladu DataSourceID člen identifikuje ovládací prvek zdroje dat za běhu. Pomocí konstruktoru ReferencedControlType bez parametrů je vlastnost nastavena na výchozí hodnotu, 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

Poznámky

Při volání tohoto konstruktoru ReferencedControlType je vlastnost nastavena na Control, což je jeho výchozí hodnota.

Viz také

Platí pro

IDReferencePropertyAttribute(Type)

Inicializuje novou instanci IDReferencePropertyAttribute třídy pomocí zadaného typu.

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

Parametry

referencedControlType
Type

Určuje Type typ ovládacího prvku reprezentovaný vlastností, na kterou IDReferencePropertyAttribute je použit.

Příklady

Následující příklad kódu ukazuje, jak IDReferencePropertyAttribute se atribut použije na vlastnost, která se vyhodnotí jako řetězec. V tomto příkladu DataSourceID člen identifikuje ovládací prvek zdroje dat a proto určuje DataSourceControl typ.

// 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

Viz také

Platí pro