The default web part template comes
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.
Figure 9-11. Displaying the custom Text property that comes with the web part template
Text property is really only
intended as a basic starting point for your own properties. Starting from
Text, the most common next steps are:
Change the property storage from personal to
Shared. Shared properties are available to everyone who views the
Serialize the property so that changes in the task pane are reflected in the web part.
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.
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
Text property, so if the member clicks Save, the
property is preserved the next time the page is
Private Const _defaultText As String = "" Dim _text As String = _defaultText ' 1) Change storage to WebPartStorage(Storage.Shared). ' and ' ...