WebPartChrome.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
)
public WebPartChrome (
	WebPartZoneBase zone, 
	WebPartManager manager
)
public function WebPartChrome (
	zone : WebPartZoneBase, 
	manager : WebPartManager
)
Not applicable.

Parameters

zone

The associated WebPartZoneBase control.

manager

The WebPartManager control on the current page.

Exception typeCondition

ArgumentNullException

zone is a null reference (Nothing in Visual Basic).

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.

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.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: