Export (0) Print
Expand All

WebPartZoneBase::CreateVerbs Event

Occurs when the verbs are created for a zone that derives from the WebPartZoneBase class.

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

public:
 event WebPartVerbsEventHandler^ CreateVerbs {
	void add (WebPartVerbsEventHandler^ value);
	void remove (WebPartVerbsEventHandler^ value);
}

Page developers can add a handler to this event, and attach additional custom verbs to a WebPartZoneBase child zone.

The CreateVerbs event is raised when the verbs are created for a zone, which happens either during the PreRender stage of page processing, or during postback events.

The following code example demonstrates a way to create a handler for the CreateVerbs event by overriding the OnCreateVerbs method to add a custom verb to a derived WebPartZoneBase zone.

The code example contains two source files. For the code example to run, you must compile this source code. You can compile it explicitly and put the resulting assembly in your Web site's Bin folder or the global assembly cache. Alternatively, you can put the source code in your site's App_Code folder, where it will be dynamically compiled at run time. This code example uses dynamic compilation. For a walkthrough that demonstrates how to compile, see Walkthrough: Developing and Using a Custom Web Server Control.

The first part of the code example is the source code for a simple control derived from the WebPart class.

No code example is currently available or this language may not be supported.

The second part of the code example is the source code for a derived WebPartZoneBase zone that overrides the OnCreateVerbs method to add a custom verb to the zone. The code also creates a custom verb that appears in the verbs menu of WebPart controls contained in the zone, and the verb creates another copy of the current WebPart control.

No code example is currently available or this language may not be supported.

The third part of the code example is a Web page that hosts the derived zone and WebPart control. Near the top of the page is a Register directive to reference the derived zone component. If you load the page in a browser, the WebPart control appears in the zone. Click the verbs menu, then click the CopyWebPart verb, and it creates a copy of the control.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
Show:
© 2015 Microsoft