Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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.

NoteNote

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

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.