共用方式為


WebPartMobileAdapter.Control property

取得正在調整 [網頁組件。

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
Protected ReadOnly Property Control As WebPart
    Get
'用途
Dim value As WebPart

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

Property value

Type: System.Web.UI.WebControls.WebParts.WebPart
改寫是 「 網頁組件。

備註

如果調整的網頁組件是Microsoft.SharePoint.WebPartPages.WebPart,則會轉換成System.Web.UI.WebControls.WebParts.WebPart ,並傳回。

Notes to inheritors

如果您覆寫CreateControlsForSummaryView()CreateControlsForDetailView()或其他方法,且您的邏輯需要 [網頁組件,改寫它不是繼承自System.Web.UI.WebControls.WebParts.WebPart成員的存取權,請考慮藉由宣告Control屬性,使用new關鍵字,隱藏在您的衍生類別中的Control 。新的屬性將轉換回其特定的網頁組件型別改寫為 [網頁組件。這麼做的範例如下。如需有關隱藏成員 (又稱為 '遮蔽' 在 Visual Basic 中),請參閱3.7.1.2 透過繼承隱藏 ,並在 Visual Basic 的 Shadowing。

Examples

下列是隱藏和取代轉換回其特定的型別 [網頁組件屬性的控制項屬性的範例。

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 class

WebPartMobileAdapter members

Microsoft.SharePoint.WebPartPages namespace

其他資源

3.7.1.2 透過繼承隱藏

在 Visual Basic 中遮蔽