Compartilhar via


CreateWebPartMenu Method

The CreateWebPartMenu method of the WebPart class is a virtual function for creating the Web Part menu when a developer wants to modify or override the default menu.

Remarks

The CreateWebPartMenu method is called after the inherited System.Web.UI.Control.Load event has occured to notify the Web Part to set the WebPartMenu property.

Example

The following code example shows an overridden CreateWebPartMenu method that adds a parent menu item and two menu items to the default Web Part menu. It assumes that this method is part of a WebPart class that includes two custom Boolean properties, ParentItemIsVisible and EnableItem1, that allow you to control when these menu items are visible and enabled. An event handler named EventHandlerForItem1 should also be created.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security