This documentation is archived and is not being maintained.

WebPartChrome::Zone Property

Gets a reference to the associated WebPartZoneBase zone.

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

protected:
property WebPartZoneBase^ Zone {
	WebPartZoneBase^ get ();
}

Property Value

Type: System.Web.UI.WebControls.WebParts::WebPartZoneBase
A reference to a WebPartZoneBase that is associated with the WebPartChrome.

The Zone property provides a reference to the WebPartZoneBase zone that contains the controls for which the WebPartChrome object provides rendering.

This code example demonstrates use of the Zone 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 Zone property to determine whether the zone currently associated with the WebPartChrome object is a zone of type MyZone. If so, the control's contents are rendered. This code would prevent the custom WebPartChrome object from working with any other zone besides the one designed to create an instance of it.

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

If you load the Web page in a browser, the content of each control is rendered normally. You can switch the page into design mode by selecting Design in the Display Mode drop-down list control. If you drag one of the controls into the empty zone labeled WebPartZone2, its contents are rendered differently, because the custom WebPartChrome object is not being used for the rendering. This is the same effect that you would achieve if you tried to use the custom WebPartChrome class with any other zone besides the MyZone class, because of the preceding source code.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: