WebPart.SetPersonalizationDirty Method ()

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 ()
protected void SetPersonalizationDirty ()
protected function SetPersonalizationDirty ()
Not applicable.

Exception typeCondition

InvalidOperationException

WebPartManager is a null reference (Nothing in Visual Basic).

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.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: