แก้ไข

แชร์ผ่าน


IDReferencePropertyAttribute Constructors

Definition

Initializes a new instance of the IDReferencePropertyAttribute class.

Overloads

IDReferencePropertyAttribute()

Initializes a new instance of the IDReferencePropertyAttribute class.

IDReferencePropertyAttribute(Type)

Initializes a new instance of the IDReferencePropertyAttribute class using the specified type.

IDReferencePropertyAttribute()

Initializes a new instance of the IDReferencePropertyAttribute class.

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

Examples

The following code example demonstrates how the IDReferencePropertyAttribute attribute is applied to a property that evaluates to a string. In this example, the DataSourceID member identifies a data source control at run time. By using the parameterless constructor, the ReferencedControlType property is set to the default value, 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

Remarks

When you call this constructor, the ReferencedControlType property is set to Control, which is its default value.

See also

Applies to

IDReferencePropertyAttribute(Type)

Initializes a new instance of the IDReferencePropertyAttribute class using the specified type.

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

Parameters

referencedControlType
Type

A Type that specifies the type of the control represented by the property to which the IDReferencePropertyAttribute is applied.

Examples

The following code example demonstrates how the IDReferencePropertyAttribute attribute is applied to a property that evaluates to a string. In this example, the DataSourceID member identifies a data source control and therefore specifies the DataSourceControl type.

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

See also

Applies to