Provides an interactive user interface (UI) element that enables users to perform actions on a Web Parts page.
See Also: WebPartVerb Members
Web Parts verbs are interactive UI elements, typically represented by buttons or hyperlinks, that appear in pages that use Web Parts controls. Users click verbs to carry out common UI actions for Web Parts controls, such as closing a System.Web.UI.WebControls.WebParts.WebPart control or closing the edit display mode (a special page view associated with the System.Web.UI.WebControls.WebParts.EditorZone control). All standard verbs provided with the Web Parts control set are associated with either a Web Parts zone (System.Web.UI.WebControls.WebParts.WebPartZone, System.Web.UI.WebControls.WebParts.EditorZone, System.Web.UI.WebControls.WebParts.CatalogZone, or System.Web.UI.WebControls.WebParts.ConnectionsZone) or a Web Parts System.Web.UI.WebControls.WebParts.Part control (System.Web.UI.WebControls.WebParts.WebPart, System.Web.UI.WebControls.WebParts.GenericWebPart, System.Web.UI.WebControls.WebParts.EditorPart, or System.Web.UI.WebControls.WebParts.CatalogPart).
When the standard verbs are associated with a zone, their actions apply at the zone level, and the verbs usually appear in the zone's header or footer area. The following table lists the common zone-level verbs and describes their actions.
Used with zones that inherit from the System.Web.UI.WebControls.WebParts.ToolZone class. Hides the UI for a zone and typically returns the page to its normal browse mode view.
Used with zones that inherit from the System.Web.UI.WebControls.WebParts.EditorZoneBase class. Applies changes that a user has made.
Used with zones that inherit from the System.Web.UI.WebControls.WebParts.EditorZoneBase class. Has the combined effect of the apply and close verbs; it applies changes and hides the zone's UI.
Used with zones that inherit from the System.Web.UI.WebControls.WebParts.ToolZone class. Cancels any pending changes a user has made.
Used with zones that inherit from the System.Web.UI.WebControls.WebParts.CatalogZoneBase class. Adds a control that a user has selected from a catalog of controls to a specified System.Web.UI.WebControls.WebParts.WebPartZone zone.
Used with zones that inherit from the System.Web.UI.WebControls.WebParts.ConnectionsZone class. Opens a view to enable users to configure existing connections.
Used with zones that inherit from the System.Web.UI.WebControls.WebParts.ConnectionsZone class. Terminates an existing connection between two controls.
As for the standard verbs that are associated with System.Web.UI.WebControls.WebParts.Part controls, their actions apply to the control itself (or to its child controls). The part control acts as a container for the verb and manages the rendering of the verb. Most standard verbs associated with part controls appear either directly in the title bar or in a drop-down verbs menu within the title bar. Whether these verbs appear directly in the header or in a verbs menu is determined by the WebPartZoneBase.WebPartVerbRenderMode property; by default, the verbs appear in a verbs menu. The following table lists common verbs associated with the various System.Web.UI.WebControls.WebParts.Part controls and describes their actions.
Appears in the verbs menu of each server control contained in a System.Web.UI.WebControls.WebParts.WebPartZoneBase zone. Reduces the control to a minimal representation, hiding everything in its UI except the restore verb.
Appears in the verbs menu of each server control contained in a System.Web.UI.WebControls.WebParts.WebPartZoneBase zone. Returns a minimized control to its normal size and view.
Appears in the verbs menu of each server control contained in a System.Web.UI.WebControls.WebParts.WebPartZoneBase zone. Closes a control and adds it to the page catalog, which means the control is removed from the page but, if there is a properly designed catalog, users can reopen the closed control and return it to the page.
Appears in the verbs menu of a control contained in a System.Web.UI.WebControls.WebParts.WebPartZoneBase zone, if the page is in connect display mode and if the control can form connections. Opens a connection UI so that users can create a connection between controls.
Appears in the verbs menu of a control contained in a System.Web.UI.WebControls.WebParts.WebPartZoneBase zone, if the control was added to the page programmatically (rather than being declared in persistence format). Permanently deletes the control instance and any associated personalization data so that, unlike a closed control, the deleted instance can never be restored to the page.
Appears in the verbs menu of a control contained in a System.Web.UI.WebControls.WebParts.WebPartZoneBase zone, if the page is designed to permit editing of controls and if the page is in edit display mode. Selects the control for editing and opens the editing UI.
Appears in the verbs menu of a control contained in a System.Web.UI.WebControls.WebParts.WebPartZoneBase zone, if the control and application are enabled for export. Opens a dialog box that enables users to export a description file that contains the serialized state of the control. For details, see the WebPart.ExportMode property.
Appears in the verbs menu of a control contained in a System.Web.UI.WebControls.WebParts.WebPartZoneBase zone, if the control is designed to provide a Help file. Launches a page that provides help for the control.
Along with the standard verbs that are provided with the Web Parts control set, you can also create custom verbs. A common scenario for creating custom verbs is to create verbs associated with System.Web.UI.WebControls.WebParts.Part controls. When you create these verbs, by default they will appear on the verbs menu along with the standard verbs. The basic approach for creating such verbs is to inherit from the System.Web.UI.WebControls.WebParts.WebPartVerb class to create one or more custom verbs. Then create a control that inherits from the System.Web.UI.WebControls.WebParts.WebPart base class and add the custom System.Web.UI.WebControls.WebParts.WebPartVerb objects to a System.Web.UI.WebControls.WebParts.WebPartVerbCollection collection. This collection can then be added to the WebPart.Verbs collection of the control, which will cause the custom verbs to appear automatically on the control's verbs menu at run time. As with the standard verbs, you can access the custom verbs programmatically on a System.Web.UI.WebControls.WebParts.WebPart control.
Web Parts applications can use server controls that do not inherit from the System.Web.UI.WebControls.WebParts.WebPart class, such as custom controls, user controls, or ASP.NET controls. These server controls, if added to a System.Web.UI.WebControls.WebParts.WebPartZoneBase zone, are dynamically wrapped with a System.Web.UI.WebControls.WebParts.GenericWebPart object at run time, which enables them to function as run-time System.Web.UI.WebControls.WebParts.WebPart controls. To add custom verbs to a server control that does not inherit from the System.Web.UI.WebControls.WebParts.WebPart class, the server control must implement the System.Web.UI.WebControls.WebParts.IWebActionable interface and override its IWebActionable.Verbs property.
When you create a verb, you can create two types of associated event handlers that will run when a user clicks the verb: a server-side event handler (code that runs on the server), and a client-side event handler (code that runs in the client browser). Also, you can define custom states for verbs, which is a useful way to provide visual cues to users. For example, you could create a state indicating that a verb has been selected, and then provide appropriate changes in the UI to notify the user that the verb is already selected. Another useful behavior is the ability to disable verbs; by doing this, you can prevent users from clicking verbs if doing so would be harmful or ineffective based on the state of the application.
The System.Web.UI.WebControls.WebParts.WebPartVerb class does not expose any unique methods; its exposed methods are all overrides of base methods. It does however contain a number of properties for developers to be aware of. The WebPartVerb.Checked property indicates whether a verb is currently selected. The WebPartVerb.ClientClickHandler and WebPartVerb.ServerClickHandler properties refer to the respective handlers within the class (if any exist) for client and server click events. The WebPartVerb.Description property contains text that describes the purpose of a verb in a ToolTip when users position a mouse pointer over the verb in the UI. The WebPartVerb.Enabled property indicates the current status of a verb, which determines whether a user can click the verb and execute its action. The WebPartVerb.ID property provides a unique ID for the verb object. The WebPartVerb.ImageUrl property contains a URL to an image that can be used to represent a verb in the UI in place of the default rendering (typically a button or a hyperlink). The WebPartVerb.Text property contains the label text that appears directly on the verb in the UI. The overridden WebPartVerb.Visible property determines whether a verb is currently displayed in the UI. Verbs are often hidden or disabled at different times in a Web Parts application; for example, specialty verbs (such as the edit verb and the connect verb) are displayed only when the appropriate controls, settings, and display modes exist on the page to enable those verbs to take meaningful action.
Other key members for working with verbs include the WebPartZoneBase.OnCreateVerbs(WebPartVerbsEventArgs) method, which is an event handler that can be overridden for custom handling of the verb creation process, and the WebPartZoneBase.CreateVerbs event.