IPersonalizable::IsDirty Property
Gets a value that indicates whether the custom data that a control manages has changed.
Assembly: System.Web (in System.Web.dll)
Property Value
Type: System::Booleantrue if the custom data managed with the IPersonalizable interface has changed; otherwise, false.
When data managed by a control has changed, the control is considered "dirty." A control should return true if the custom data that it manages through the IPersonalizable interface has changed. If a control returns true from this property, the control's Save interface method implementation is called during property value extraction.
Note |
|---|
This property is checked automatically by the personalization infrastructure during the latter phases of processing a POST request. However, for GET requests, the value returned from the IsDirty property is not checked. Some other event has to have caused the control to be considered "dirty" for any control state--not just data managed by IPersonalizable--to be saved. If a control can mark itself as "dirty" during a GET request, or if the personalization infrastructure under some very specific boundary conditions considers a control "dirty" during a GET request, then Save will always be called. |
A control can reference its associated WebPartManager control and check the Scope property to determine the current scope. The "dirty" state of a control's custom data should be appropriate for the current scope.
The following code example demonstrates use of the IsDirty property. The first part of the example is the Web page that hosts a WebPart control.
The second part of the example is the code for the custom WebPart control called UrlListWebPart. This file should be placed in the App_Code directory to run the example. Note that the source code implements the IsDirty property.
Load the page in a browser. Type in a name to represent a URL, then add an actual URL beginning with http://, and click the Add button to add the URL.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note