DataBoundControlAdapter.Control 属性

定义

检索对与此控件适配器关联的 DataBoundControl 对象的强类型引用。Retrieves a strongly-typed reference to the DataBoundControl object associated with this control adapter.

protected:
 property System::Web::UI::WebControls::DataBoundControl ^ Control { System::Web::UI::WebControls::DataBoundControl ^ get(); };
protected System.Web.UI.WebControls.DataBoundControl Control { get; }
member this.Control : System.Web.UI.WebControls.DataBoundControl
Protected ReadOnly Property Control As DataBoundControl

属性值

DataBoundControl

附加此 DataBoundControlDataBoundControlAdapterThe DataBoundControl to which this DataBoundControlAdapter is attached.

示例

下面的代码示例演示如何重写 Control 从类派生的适配器中的属性 DataBoundControlAdapterThe following code example shows how to override the Control property in an adapter derived from the DataBoundControlAdapter class. 它返回对控件的强类型引用 MyDataBoundIt returns a strongly typed reference to the MyDataBound control.

// Returns a strongly-typed reference to the MyDataBound control.
public new MyDataBound Control
{
    get
    {
        return (MyDataBound)base.Control;
    }
}
' Returns a strongly-typed reference to the MyDataBound control.
Public Shadows ReadOnly Property Control() As MyDataBound
    Get
        Return CType(MyBase.Control, MyDataBound)
    End Get
End Property

注解

DataBoundControlAdapter 对象附加到 DataBoundControl 控件时,.NET Framework 将调用某些适配器成员而不是控件成员。When a DataBoundControlAdapter object is attached to a DataBoundControl control, the .NET Framework calls certain adapter members instead of the control members.

继承者说明

从类继承时 DataBoundControlAdapter ,至少应实现 Control 属性以返回控件的强类型实例,如 "示例" 部分所示。When you inherit from the DataBoundControlAdapter class, you should, at a minimum, implement a Control property to return a strongly typed instance of the control, as shown in the Example section

适用于

另请参阅