WebPartPersonalization.Save Method ()


Saves personalization data for the current page, scope, and user to the underlying data store.

Namespace:   System.Web.UI.WebControls.WebParts
Assembly:  System.Web (in System.Web.dll)

protected virtual void Save()

Exception Condition

The current user does not have the capability called ModifyStateUserCapability.

- or -

The WebPartPersonalization instance cannot reference a valid personalization provider.

- or -

No personalization provider is currently associated with the WebPartPersonalization instance. This can occur if this method is called prior to calling Load (the personalization provider reference is obtained during the call to Load.

- or -

No personalization state has been loaded.

- or -

The Page instance for the associated WebPartManager is null.

- or -

The value of the Request property on the WebPartManager control's associated Page instance is null.

This method is called during the WebPartManager control's SaveStateComplete event. Internally, the method calls the SavePersonalizationState method on the provider.

Attempting to save personalization data when the currently executing user does not have the capability called ModifyStateUserCapability (within the current WebPartUserCapability instance) results in an InvalidOperationException exception. Note that this would only be true if the WebPartManager control called the protected Save method directly. In the ASP.NET implementation, an internal helper method is actually called to perform the save, and this helper method silently returns if the currently executing user does not have rights to modify data.

.NET Framework
Available since 2.0
Return to top