WebPartMobileAdapter.Control 属性

获取正在改编 Web 部件。

命名空间:  Microsoft.SharePoint.WebPartPages
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Protected ReadOnly Property Control As WebPart
    Get
用法
Dim value As WebPart

value = Me.Control
protected WebPart Control { get; }

属性值

类型:System.Web.UI.WebControls.WebParts.WebPart
正在改编 Web 部件。

备注

修改的 Web 部件是否Microsoft.SharePoint.WebPartPages.WebPart,它是强制转换为System.Web.UI.WebControls.WebParts.WebPart ,并返回。

针对继承者的注释

如果重写CreateControlsForSummaryView()CreateControlsForDetailView()或某些其他方法,并且您的逻辑需要向正在改编它不能继承System.Web.UI.WebControls.WebParts.WebPartWeb 部件的成员的访问,请考虑通过声明Control属性,使用new关键字隐藏Control派生类中。新的属性强制转换程序正在改编回其特定的 Web 部件类型的 Web 部件。下面是执行此操作的示例。有关隐藏成员 (这称为隐藏在 Visual Basic 中) 的详细信息,请参阅3.7.1.2 通过继承隐藏和Visual Basic 中的 Shadowing。

示例

下面是隐藏和控件属性替换强制转换回其特定类型的 Web 部件的属性的示例。

protected new SomeWebPart Control
{
    get { return base.Control as SomeWebPart; }
}
Protected Shadows ReadOnly Property Control() As SomeWebPart
    Get
        Return TryCast(MyBase.Control, SomeWebPart)
    End Get
End Property

另请参阅

引用

WebPartMobileAdapter 类

WebPartMobileAdapter 成员

Microsoft.SharePoint.WebPartPages 命名空间

其他资源

3.7.1.2 通过继承隐藏

在 Visual Basic 中隐藏