IPersonalizable.IsDirty Property
Assembly: System.Web (in system.web.dll)
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 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note