The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WebPart.SetPersonalizationDirty Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Sets a flag indicating that personalization data has changed for the current WebPart control instance.

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

protected void SetPersonalizationDirty()

The SetPersonalizationDirty method sets a flag indicating that control state data has been changed (personalized) on a WebPart control, and that the WebPartManager control therefore needs to persist the personalization data to long term storage.

Normally the WebPartManager persists personalization changes on WebPart controls without a need for developers to call the SetPersonalizationDirty method. But there are two cases in which developers do need to call this method. The first case is when control state data is changed during an HTTP GET request to a page. By default, changes to control state data during a GET request are not persisted (for security purposes). But the SetPersonalizationDirty method provides a way to persist legitimate personalization changes to WebPart controls in this case.

The second case for calling the SetPersonalizationDirty method occurs during an HTTP POST request to a page. If a WebPart control has complex personalizable properties (such as a property that contains an ArrayList object), and control state data in those properties is personalized during a POST request, developers must call the SetPersonalizationDirty method to ensure that the changes are persisted.

.NET Framework
Available since 2.0
Return to top