IPersonalizable.IsDirty Property


Gets a value that indicates whether the custom data that a control manages has changed.

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

abstract IsDirty : bool with get

Property Value

Type: System.Boolean

true 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.


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.

No code example is currently available or this language may not be supported.

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.

No code example is currently available or this language may not be supported.

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.

.NET Framework
Available since 2.0
Return to top