语言

DataBoundControlAdapter.Control 属性

定义

检索与此控件适配器关联的对象的强类型引用 DataBoundControl 。

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 的 DataBoundControlAdapter 项。

示例

下面的代码示例演示如何重写 Control 派生自类的 DataBoundControlAdapter 适配器中的属性。 它返回对控件的 MyDataBound 强类型引用。

// 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 将调用某些适配器成员,而不是控件成员。

继承者说明

从 DataBoundControlAdapter 类继承时,应至少实现一个 Control 属性以返回控件的强类型实例,如“示例”部分所示

适用于

另请参阅