Saving Web Part Properties
All Web Part properties with a WebPartstorage attribute of Shared or Personal are persisted in the Microsoft® Windows® SharePoint™ Services database. In addition to this setting, the developer is responsible for saving changes to properties in both of the following scenarios:
- If you are accessing the Web Part and its properties through the SharePoint object model, you must invoke the SaveChanges method of the SPWebPartCollection class to save changes. This is the most common way to make changes to a property and includes changes made through the basic (or custom) tool pane.
- If a property is changed while the Web Part is actively being rendered, you must set the SaveProperties property of the WebPart class to true. If true, the Web Part's property values are queried after the System.Web.UI.Control.UnLoad event fires, and changes are stored in the database. If this property is false, no changes are saved, and the properties revert to their original values the next time the Web Part is instantiated.
For more information about the WebPartStorage attribute, see Web Part Storage.