SharePoint

Sharepoint Webpart development with Customized ToolPart

To add customized Html content to the Toolpart panel, we need develop a Toolpart object, attach it to the webpart object.

the steps to add a toolpart object to a webpart:

1. Create a ToolPart object implement the Microsoft.SharePoint.WebPartPages.ToolPart

2. override the ApplyChanges method, save the values entered in the ToolPart panel to the webpart, calling this.ParentToolPane.SelectedWebPart can get the reference object to its webpart object

3. override the GetToolParts method in the webpart class, add the customized ToolPart object to the ToolPart list

Note: to retain the properties value defined in the webpart, the properties must be set to Personalizable attribute. PeralizationScope.Shared will make the variable visible to everybody, PeralizationScope.User will make the variable consistance and retained for the specific user.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s