WebPartZone Class

The WebPartZone class allows you to create zones which are containers for Web Parts. The properties of this class allows you to specify how the zone will appear on your Web Part Page and also the behavior of the zone itself. For example, when you create the zone object, you can allow personalization and/or customization for the Web Parts placed within the zone.




Public Constructors

The following table shows the constructors of the WebPartZone class and a brief description of each.

Name Description
WebPartZone Initializes a new instance of the WebPartZone class.

Public Methods

The following table shows the methods of the WebPartZone class and a brief description of each.

Name Description
Dispose Releases all the resources that are owned by the Web Part zone before the zone is unloaded.

Public Properties

The following table shows the properties of the WebPartZone class, the data type of each property, and a brief description of each.

Name Data type Description
AllowCustomization Boolean Determines whether the Web Parts within the zone can be modified for all users.
AllowPersonalization Boolean Determines whether the Web Parts within the zone can be modified for individual users.
ContainerWidth String Specifies the width of the zone to the Web Parts contained within the zone. The ContainerWidth cannot be set when the Orientation is set to horizontal.
FrameType Microsoft.SharePoint.WebPartPages.FrameType Defines the default FrameType for Web Parts in the zone.
LockLayout Boolean Determines whether Web Parts within the zone can be added, deleted, resized, or moved.
Orientation Microsoft.SharePoint.WebPartPages.Orientation Determines which direction Web Parts will be placed in the zone: vertical or horizontal.
Title String Specifies the friendly name used in the Web Part page designer and Microsoft Office FrontPage to denote a zone to the user.]

Protected Methods

The following table shows the protected methods of the WebPartZone class and a brief description of each.

Name Description
AddParsedSubObject(object) Notifies the Web Part page that the HTML elements comprising the Web Part zone were parsed, and adds the zone to the WebPartPage object.
CreateChildControls Used to create the zone control in the Web Part page.
Finalize Releases unmanaged resources and performs other cleanup operations before garbage collection is performed. Should be called before the Dispose method.
LoadViewState(object) Loads the last saved ViewState of the page before it is rendered.
OnInit(System.EventArgs) Handles the Init event. The Init event occurs as the Web Part zone control is being instantiated.
OnLoad(System.EventArgs) Handles the Load event. The Load event occurs when the zone is loaded into the Web Part Page. Notifies the page to perform any processing steps that are set to occur on each page request.
OnPreRender(System.EventArgs) Handles the PreRender event. The PreRender event occurs when the Web Part Page is about to render to the zone.
Render(System.Web.UI.HtmlTextWriter) Sends Web Part Page content to the provided HtmlTextWriter object, which writes the content to be rendered on the client browser.
SaveViewState Saves any Web Part Page view-state changes, such as those affected by zone changes, that have occurred since the time the page was last posted back to the server.


The WebPartZone class inherits the System.Web.UI.Control.ID property, which is a string value that is used to specify the programmatic identifier assigned to a WebPartZone control. The value of a WebPartZone control's ID property is used to assign the ZoneID property of an instance of a WebPart class.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.


Namespace: Microsoft.SharePoint.WebPartPages

Platforms: Microsoft Windows Server 2003

Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Security: Code Access Security