WebPart 构造函数

初始化继承的类实例使用的类。只能由继承的类调用此构造函数。

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

语法

声明
Protected Sub New
用法

Dim instance As New WebPart()
protected WebPart()

备注

WebPart 构造函数初始化为默认值与不同的继承自WebPart属性的默认值。具体而言,构造函数初始化将ExportMode属性设为AllModelessHelpMode属性。

示例

下面的示例演示一个 Web 部件控件,从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

另请参阅

引用

WebPart 类

WebPart 成员

Microsoft.SharePoint.WebPartPages 命名空间

ExportMode

HelpMode