This documentation is archived and is not being maintained.

WebPartPersonalization::CopyPersonalizationState Method

Extracts the personalization state from one Web Parts control and applies it to a second Web Parts control.

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

protected public:
virtual void CopyPersonalizationState(
	WebPart^ webPartA, 
	WebPart^ webPartB
)

Parameters

webPartA
Type: System.Web.UI.WebControls.WebParts::WebPart
The Web Parts control supplying the personalization data.
webPartB
Type: System.Web.UI.WebControls.WebParts::WebPart
The Web Parts control receiving the personalization data.

ExceptionCondition
ArgumentNullException

Either webPartA or webPartB is nullptr.

ArgumentException

webPartA and webPartB are not of the same Type.

- or -

webPartA and webPartB are GenericWebPart controls but one or both lack a child control.

- or -

webPartA and webPartB are GenericWebPart controls, but their child controls are not of the same Type.

This method extracts the personalization state from webPartA and applies it to webPartB. This method assumes that webPartA and webPartB are the same type. If the Web Parts controls are GenericWebPart controls, the method copies the personalization state from the child control wrapped in webPartA to the child control wrapped in webPartB.

As part of the copy operation, webPartB is marked as "dirty".

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

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.
Show: