WebPartChrome.WebPartManager Property
Assembly: System.Web (in system.web.dll)
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.
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.
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.