共用方式為


IDReferencePropertyAttribute 建構函式

定義

初始化 IDReferencePropertyAttribute 類別的新執行個體。

多載

名稱 Description
IDReferencePropertyAttribute()

初始化 IDReferencePropertyAttribute 類別的新執行個體。

IDReferencePropertyAttribute(Type)

使用指定型別初始化該類別的新實例 IDReferencePropertyAttribute

IDReferencePropertyAttribute()

初始化 IDReferencePropertyAttribute 類別的新執行個體。

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

範例

以下程式碼範例示範如何將屬性 IDReferencePropertyAttribute 套用到一個屬性,該屬性會評估字串。 在此範例中, DataSourceID 成員在執行時識別資料來源控制。 透過使用無參數建構子,屬性 ReferencedControlType 被設定為預設值 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

備註

當你呼叫這個建構子時,屬性 ReferencedControlType 會被設定為 Control,這是它的預設值。

另請參閱

適用於

IDReferencePropertyAttribute(Type)

使用指定型別初始化該類別的新實例 IDReferencePropertyAttribute

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

參數

referencedControlType
Type

A Type 指定所 IDReferencePropertyAttribute 應用屬性所代表控制項的類型。

範例

以下程式碼範例示範如何將屬性 IDReferencePropertyAttribute 套用到一個屬性,該屬性會評估字串。 在此範例中,DataSourceID成員識別資料來源控制,並指定類型。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

另請參閱

適用於