Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0
 CloseWebPart Method
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Class Library
WebPartZoneBase.CloseWebPart Method

Note: This method is new in the .NET Framework version 2.0.

Closes a selected WebPart control in a zone.

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

Visual Basic (Declaration)
Protected Overridable Sub CloseWebPart ( _
    webPart As WebPart _
)
Visual Basic (Usage)
Dim webPart As WebPart

Me.CloseWebPart(webPart)
C#
protected virtual void CloseWebPart (
    WebPart webPart
)
C++
protected:
virtual void CloseWebPart (
    WebPart^ webPart
)
J#
protected void CloseWebPart (
    WebPart webPart
)
JScript
protected function CloseWebPart (
    webPart : WebPart
)

Parameters

webPart

The WebPart control to be closed.

The typical way for an end user to close a WebPart control is by clicking the close verb in the control's title bar. The CloseWebPart method calls the CloseWebPart method on the WebPartManager class, which carries out the action of closing the control. The method should only be used by derived WebPartZoneBase zones such as WebPartZone.

A closed WebPart control is not rendered on a page. Instead, it is added to the page catalog, which maintains a list of all closed controls on a page. If a Web Parts page on which a user closes a control also has an <asp:PageCatalogPart> element declared with a CatalogZone, then the user can switch the page into catalog display mode, and add the closed control back to the page.

NoteNote

For a user to be able to close a WebPart control, the AllowClose property on the control and the AllowLayoutChange property on the zone must both be set to true.

Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker