WebPart constructor
初始化使用類別繼承的類別執行個體。此建構函式僅可以呼叫由繼承的類別。
Namespace: Microsoft.SharePoint.WebPartPages
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Protected Sub New
'用途
Dim instance As New WebPart()
protected WebPart()
備註
網頁組件建構函式初始化屬性的預設值與繼承自WebPart的不同位置的預設值。特別是,以AllExportMode屬性以及ModelessHelpMode屬性,會將初始化建構函式。
Examples
下列範例會顯示網頁組件控制項繼承WebPart類別,但變更衍生控制項的建構函式中的一個屬性的值。
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
namespace MyWebParts
{
public class BasicSharepointWebPart : WebPart
{
public BasicSharepointWebPart() : base()
{
this.ExportMode = System.Web.UI.WebControls.WebParts.WebPartExportMode.NonSensitiveData;
}
}
}
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.WebControls
Imports Microsoft.SharePoint.WebPartPages
Namespace MyWebParts
Public Class BasicSharepointWebPart
Inherits WebPart
Public Sub New()
MyBase.New()
Me.ExportMode = WebParts.WebPartExportMode.NonSensitiveData
End Sub
End Class
End Namespace