IWebActionable Interface

Enables WebPart controls or other server controls to contain collections of verbs.

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

public interface class IWebActionable

The IWebActionable type exposes the following members.

  NameDescription
Public propertyVerbsGets a reference to a collection of custom WebPartVerb objects.
Top

A verb in WebPart controls is an action that a user can carry out in the user interface (UI). Typically, a verb is represented in the UI by a clickable control such as a button, a link, or a menu item. The Web Parts control set provides standard verbs that are available by default to WebPart controls and other server controls (such as custom, ASP.NET, and user controls) that can act like WebPart controls when placed in WebPartZoneBase zones. Standard verbs include close, minimize, restore, delete, edit, and export.

You can also create custom verbs for use with WebPart and server controls. The IWebActionable interface, with its Verbs property, gives you a way to integrate custom verbs into your controls. The WebPart class implements the IWebActionable interface and implements its single property. To add custom verbs to a control that inherits from the WebPart class, you must override the WebPart::Verbs property, add custom verbs to a collection, and return the collection. The collection referenced by the WebPart::Verbs property contains only custom verbs; standard verbs are not included in this collection. The default return value of the WebPart::Verbs property in a WebPart control is nullptr, because by default there are no custom verbs in the collection.

Adding custom verbs to server controls that are not WebPart controls requires one extra step. In those cases, the controls must also implement the IWebActionable interface and implement the Verbs property.

After you have added custom verbs to the Verbs collection, the Web Parts control set automatically handles the other steps necessary to create and render the custom verbs.

The following code example demonstrates a simple implementation of the IWebActionable interface. The first part of the code example shows how the interface is implemented in a user control. The user control implements the Verbs property by creating two custom verbs and defining a method that is called when a user clicks either of the verbs. For simplicity, the same method is used for both verbs. The method updates the value of a property named VerbCounterClicks. The code for the Page_Load method accesses the Verbs property of the control to display the total count of custom verbs in the collection. This count does not include the standard Web Parts verbs.

Security noteSecurity Note

This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

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

The second part of the code example is an .aspx page that hosts the user control. Because the control is referenced in a WebPartZone control, at run time ASP.NET wraps the user control in a GenericWebPart control and treats it as a WebPart control. After you load the page in a browser, notice that the label at the bottom of the control displays how many custom verbs are in the collection referenced by the Verbs property. Also note that if you click the verbs menu in the control, and click either of the verbs, another label appears showing the total number of times the custom verbs have been clicked.

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft