Partager via


Visual Basic Concepts

Custom Webitem Events

You can add custom events to webitems in order to provide additional event handling for them. When you create a custom event, you associate it with the template or custom webitem for which it will be fired, then define the code to determine the action Visual Basic takes when the event fires.

Custom events can be fired directly from the browser through the URLFor method. For example, you can access a custom event by using the URLFor method to reference the custom webitem and event name, as shown in the following code:

Response.Write "<A HREF=""" & URLFor(CustomWebItem1,"CustomEventName") _
& """></A>"

When the user selects this hyperlink in the browser, the webclass intercepts the request and fires the specified custom event on the server.

To add custom events to a custom webitem

  1. In the left panel of the designer window, right-click the custom webitem to which you want to add an event.

  2. Click Add Custom Event. An event appears in the right panel of the designer window.

  3. Write code for the event.

For More Information   See "Firing Custom Events" and "Specifying URLs for Webitems" for more information on the URLFor method, or see "URLData Property" in the Language Reference.