แก้ไข

แชร์ผ่าน


WebPart.SetPersonalizationDirty Method

Definition

Sets a flag indicating that personalization data has changed for a Web Parts control or a server control placed in a WebPartZoneBase zone.

Overloads

SetPersonalizationDirty(Control)

Sets a flag indicating that personalization data has changed for the specified server control that resides in a WebPartZoneBase zone.

SetPersonalizationDirty()

Sets a flag indicating that personalization data has changed for the current WebPart control instance.

SetPersonalizationDirty(Control)

Sets a flag indicating that personalization data has changed for the specified server control that resides in a WebPartZoneBase zone.

public:
 static void SetPersonalizationDirty(System::Web::UI::Control ^ control);
public static void SetPersonalizationDirty (System.Web.UI.Control control);
static member SetPersonalizationDirty : System.Web.UI.Control -> unit
Public Shared Sub SetPersonalizationDirty (control As Control)

Parameters

control
Control

The Control for which the personalization data has changed.

Exceptions

The object in the control parameter is null.

The control is not associated with a page.

-or-

The control derives from WebPart. Controls that derive from WebPart should use the protected SetPersonalizationDirty() method instead.

The page associated with the control does not have a WebPartManager.

Remarks

The WebPart.SetPersonalizationDirty method has the same purpose as the WebPart.SetPersonalizationDirty() method, which is to set a flag indicating that control state data has been changed (personalized) on a server control during an HTTP GET request. The difference between these methods is that the WebPart.SetPersonalizationDirty method is used for server controls that do not inherit from the WebPart class, but are placed within WebPartZoneBase zones to participate in Web Parts applications.

See also

Applies to

SetPersonalizationDirty()

Sets a flag indicating that personalization data has changed for the current WebPart control instance.

protected:
 void SetPersonalizationDirty();
protected void SetPersonalizationDirty ();
member this.SetPersonalizationDirty : unit -> unit
Protected Sub SetPersonalizationDirty ()

Exceptions

Remarks

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.

See also

Applies to