Transitioning Between WebItems

You use the NextItem property to shift processing from one webitem to another on the server. You might do this if there are several processes you want to perform before returning a response to the browser. Normally, the webclass performs these steps when it receives a request:

  1. Intercepts the request and matches it to a webitem in the application.

  2. Identifies the proper event to fire on the webitem, then fires it.

  3. Processes any code for that event.

  4. Returns a response to the browser.

NextItem is used to add an extra step to this process. After the webclass processes the code for the event it matches to the request, the NextItem property can pass processing along to another webitem. This allows the application to perform additional processing before returning a response to the user. The process is now this:

  1. Intercepts the request and matches it to a webitem in the application.

  2. Identifies the proper event to fire on the webitem, then fires it.

  3. Processes any code for that event.

  4. Processes the NextItem property and shifts processing to another webitem and fires its Respond event.

  5. Returns a response to the browser.

Note   No matter where the NextItem property occurs in the event procedure, Visual Basic finishes processing that procedure before it shifts processing to the indicated webitem. This is the main difference between setting the NextItem and directly calling an event subroutine in another webitem.

The following code shows NextItem used in a Respond event:

Private Sub Feedback_Respond()
   ' Code to process the contents of the feedback form
   ' inserted here.
   ' Transition:
   Set NextItem = Thankyou
End Sub

This procedure is fired when the user submits the contents of a page containing a feedback form. In response, Visual Basic transitions to another webitem containing a thank-you page.

There are three situations in which the webclass ignores the NextItem property. If you use the property in event procedures for the following events, the webclass will not process the NextItem property:

For More Information   See "NextItem Property" in the Language Reference.