This documentation is archived and is not being maintained.

WebPartChrome Constructor

Initializes a new instance of the control.

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

public:
WebPartChrome(
	WebPartZoneBase^ zone, 
	WebPartManager^ manager
)

Parameters

zone
Type: System.Web.UI.WebControls.WebParts::WebPartZoneBase
The associated WebPartZoneBase control.
manager
Type: System.Web.UI.WebControls.WebParts::WebPartManager
The WebPartManager control on the current page.

ExceptionCondition
ArgumentNullException

zone is nullptr.

The WebPartChrome initializes a new instance of the WebPartChrome class. It is used primarily by a WebPartZoneBase zone in its CreateWebPartChrome method to create an instance of the WebPartChrome object that handles the chrome rendering and any custom rendering for WebPart controls in the zone.

The following code example demonstrates two things. First, it creates a new instance of the custom class MyWebPartChrome by overriding the CreateWebPartChrome method in a derived WebPartZoneBase zone called MyZone. Second, in the constructor of the MyWebPartChrome class, it assigns the objects in the parameters of the constructor to private fields that can be used within the class. This example thus gives you a way to access the associated zone and WebPartManager object even in the constructor, before the Zone and WebPartManager properties are accessible. Finally, note that for the constructor to work, the base constructor must also be invoked as part of the method declaration.

The following code contains the two custom classes. For the full code required to run the example, including the Web page to host these controls, see the Example section of the WebPartChrome class overview topic.

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

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