Visual Basic Concepts
You use the URLFor method to easily create hyperlinks that jump to other webitems in your application. When the webclass displays a webitem in the browser, it must first locate the template file for that webitem on the server. You might not know the exact location to which you will deploy the application when you write the code. URLFor provides a convenient shortcut for you to use in these situations.
Note In addition to specifying the location of the webitem, the URLFor method can also fire a specified event. The event argument is optional.
The following code shows how you might use URLFor to create a link to a webitem:
Private Sub ThankYouForm_Respond
With Response
.Write "<HTML>"
.Write "<BODY>"
.Write "Thank you for completing our survey. <P>"
.Write "To return to the order inquiry page, select the _
following link: <P>"
.Write "<A HREF=""" & URLFor(CustomerOrder) & """ & Return</A>"
.Write "</BODY>"
.Write "</HTML>"
End With
End Sub
In this code, the developer creates a simple HTML page by using the Response object's Write method to create the HTML line by line. One of the elements created is a hyperlink that moves to another webitem called "CustomerOrder." The code for this hyperlink uses the URLFor method rather than specifying the exact location of the webitem on the server. No event is specified for the CustomerOrder webitem, so by default the run-time DLL launches the webitem's Respond event.
For More Information See "Firing Custom Events" for more information on using the URLFor method to fire events.