Condividi tramite


IDReferencePropertyAttribute Costruttori

Definizione

Inizializza una nuova istanza della classe IDReferencePropertyAttribute.

Overload

Nome Descrizione
IDReferencePropertyAttribute()

Inizializza una nuova istanza della classe IDReferencePropertyAttribute.

IDReferencePropertyAttribute(Type)

Inizializza una nuova istanza della IDReferencePropertyAttribute classe utilizzando il tipo specificato.

IDReferencePropertyAttribute()

Inizializza una nuova istanza della classe IDReferencePropertyAttribute.

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

Esempio

Nell'esempio di codice seguente viene illustrato come l'attributo IDReferencePropertyAttribute viene applicato a una proprietà che restituisce una stringa. In questo esempio, il DataSourceID membro identifica un controllo origine dati in fase di esecuzione. Usando il costruttore senza parametri, la ReferencedControlType proprietà viene impostata sul valore predefinito , 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

Commenti

Quando si chiama questo costruttore, la ReferencedControlType proprietà viene impostata su Control, ovvero il valore predefinito.

Vedi anche

Si applica a

IDReferencePropertyAttribute(Type)

Inizializza una nuova istanza della IDReferencePropertyAttribute classe utilizzando il tipo specificato.

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

Parametri

referencedControlType
Type

Oggetto Type che specifica il tipo del controllo rappresentato dalla proprietà a cui viene applicato l'oggetto IDReferencePropertyAttribute .

Esempio

Nell'esempio di codice seguente viene illustrato come l'attributo IDReferencePropertyAttribute viene applicato a una proprietà che restituisce una stringa. In questo esempio, il DataSourceID membro identifica un controllo origine dati e quindi specifica il DataSourceControl tipo .

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

Vedi anche

Si applica a