IDReferencePropertyAttribute Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應