Bagikan melalui


IDReferencePropertyAttribute Konstruktor

Definisi

Menginisialisasi instans baru dari kelas IDReferencePropertyAttribute.

Overload

Nama Deskripsi
IDReferencePropertyAttribute()

Menginisialisasi instans baru dari kelas IDReferencePropertyAttribute.

IDReferencePropertyAttribute(Type)

Menginisialisasi instans IDReferencePropertyAttribute baru kelas menggunakan jenis yang ditentukan.

IDReferencePropertyAttribute()

Menginisialisasi instans baru dari kelas IDReferencePropertyAttribute.

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

Contoh

Contoh kode berikut menunjukkan bagaimana IDReferencePropertyAttribute atribut diterapkan ke properti yang mengevaluasi ke string. Dalam contoh ini, DataSourceID anggota mengidentifikasi kontrol sumber data pada waktu proses. Dengan menggunakan konstruktor tanpa parameter, ReferencedControlType properti diatur ke nilai default, 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

Keterangan

Ketika Anda memanggil konstruktor ini, ReferencedControlType properti diatur ke Control, yang merupakan nilai defaultnya.

Lihat juga

Berlaku untuk

IDReferencePropertyAttribute(Type)

Menginisialisasi instans IDReferencePropertyAttribute baru kelas menggunakan jenis yang ditentukan.

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

Parameter

referencedControlType
Type

Type yang menentukan jenis kontrol yang diwakili oleh properti tempat IDReferencePropertyAttribute diterapkan.

Contoh

Contoh kode berikut menunjukkan bagaimana IDReferencePropertyAttribute atribut diterapkan ke properti yang mengevaluasi ke string. Dalam contoh ini, DataSourceID anggota mengidentifikasi kontrol sumber data dan karenanya menentukan jenisnya DataSourceControl .

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

Lihat juga

Berlaku untuk