Skip to Main Content
Essential SharePoint
book

Essential SharePoint

by Jeff Webb
May 2005
Beginner content levelBeginner
336 pages
10h 14m
English
O'Reilly Media, Inc.
Content preview from Essential SharePoint

Adding Properties

The default web part template comes with a Text property. That property appears at the bottom of the property task pane in the Miscellaneous category if you display the web part page in a personal view and then select Modify My Web Part, as shown in Figure 9-11.

Displaying the custom Text property that comes with the web part template

Figure 9-11. Displaying the custom Text property that comes with the web part template

The provided Text property is really only intended as a basic starting point for your own properties. Starting from Text, the most common next steps are:

  1. Change the property storage from personal to Shared. Shared properties are available to everyone who views the page.

  2. Serialize the property so that changes in the task pane are reflected in the web part.

  3. Link the property setting to the value of a child control on the web part. That allows members to change the property and see the effects of the change.

  4. Save the property to the content database; otherwise, changes are lost when the member navigates away from the page.

The following code illustrates these changes by extending the template code to create a simple web part with a textbox and a Save button. The textbox is linked to the Text property, so if the member clicks Save, the property is preserved the next time the page is viewed:

 Private Const _defaultText As String = "" Dim _text As String = _defaultText   ' 1) Change storage to WebPartStorage(Storage.Shared). ' and ' ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SharePoint User's Guide

SharePoint User's Guide

Infusion Development Corp. (Infusion Development Corporation)
Beginning SharePoint® 2010: Building Business Solutions with SharePoint

Beginning SharePoint® 2010: Building Business Solutions with SharePoint

Amanda Perran, Shane Perran, Jennifer Mason, Laura Rogers

Publisher Resources

ISBN: 0596008805Errata Page