You can associate a WebClass object with an existing HTML file. This file then
becomes the HTML template for the WebClass.
To associate an HTML template with a WebClass, follow these steps:
STEP BY STEP
17.1 Associating an HTML Template With a WebClass Object
Use a text editor or HTML editor to create a standard HTML file in a different
directory from your project.
Make sure that you have saved your IIS project before proceeding.
In your IIS project, open the WebClass designer and right-click on HTML Template
WebItems to bring up the shortcut menu.
On the shortcut menu, choose Add HTML Template to bring up the File Browse
Navigate to and select the HTML file.
Double-click the WebClass designer to bring up its Code window. Comment out
or delete the default code in the Start event procedure.
In the Start event procedure of the WebClass designer, write a line of the
where TemplateName is the name within the project of the HTML template that you
just added. (If you did nothing to change it, the default name will be Template1.)
If you run the application now, you will see your default HTML page displayed
in the browser.
At its simplest, an HTML template can contain ordinary, HTMLstandard code.
The WebClass would just pass such a file through to client browsers, adding no
more functionality. As you might imagine, this would be a gross under-use of the
potential of the HTML template. The true power of an HTML template lies in the
extra functionality that it can give to a WebClass in your IIS application. You
can enhance normal HTML functionality in several ways with an HTML template:
You can embed special substitution tags in the HTML file and replace those
tags with your own programmatically determined values before submitting the HTML
to the client browser.
You can associate any standard HTML tag that uses a URL (such as an IMG tag
that refers to an image file location) with an event in your WebClass.
The following section discusses these features.
NOTE - Editing the HTML Template: File Although
you added the HTML template from a different directory, VB will make a copy of
the file in the project directory. You should edit the copy in the project directory
after you have added the file to the project.