This documentation is archived and is not being maintained.

WebPartChrome::WebPartManager Property

Gets a reference to the current WebPartManager instance.

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

protected:
property WebPartManager^ WebPartManager {
	WebPartManager^ get ();
}

Property Value

Type: System.Web.UI.WebControls.WebParts::WebPartManager
A reference to the current WebPartManager on the Web page.

The WebPartManager property provides a reference to the current WebPartManager instance on the page.

This code example demonstrates use of the WebPartManager property. For the full code required to run the example, see the Example section of the WebPartChrome class overview topic.

The following code example uses the WebPartManager property to determine whether the current WebPart control being rendered is the selected control, which in this example means that the page is in edit view, and the control is currently being edited. If these conditions are true, the body of the control is not rendered, and a string is written in its place.

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

If you load the Web page in a browser, you can switch the page into edit mode by selecting Edit in the Display Mode drop-down list control. You can click the edit verb in the verbs menu of either of the controls; when the page is rendered, the body of the control selected for editing is not rendered. However, if you drag the control into the empty zone labeled WebPartZone2, the body of the control is rendered. This is because the second zone is a standard WebPartZone zone, and it does not use the custom WebPartChrome class in this example to render the WebPart controls.

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