WebPartManager.WebPartClosed Event

Definition

Occurs when a WebPart control (or server or user control) is removed from a page.

C#
public event System.Web.UI.WebControls.WebParts.WebPartEventHandler WebPartClosed;

Event Type

Remarks

The WebPartClosed event indicates that a control has been successfully closed, either by a user or programmatically. To close a WebPart control means to remove it from a page so that it is not rendered, and also to place it in a special holding object called a page catalog. A page catalog, which corresponds to the PageCatalogPart control, maintains references to closed WebPart controls for each page. If a PageCatalogPart control is declared on a page within a CatalogZone zone, users can switch a page into catalog display mode, and add back to a page any controls that were previously closed.

The WebPartClosed event is associated with the OnWebPartClosed method, which both raises the event and provides a handler for it.

Page developers can add a custom handler for the event by adding an OnWebPartClosed attribute to the <asp:webpartmanager> element in a page, and then assigning a custom method name to the attribute.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also