Before you can use any feature (such as a DTC) that depends upon the Scripting Object Model, you must enable the SOM. If you try to insert an object in a page that requires the Scripting Object Model but have not yet enabled the SOM, Visual InterDev will warn you that you need to enable the SOM first and will prompt you to enable it.
You can directly enable the Scripting Object Model with these steps:
This will add the SOM code to your page, enabling you to use DTCs and other features that require the Scripting Object Model. This process is
<%@ Language=VBScript %> <% ' VI 6.0 Scripting Object Model Enabled %> <!--#include file="_ScriptLibrary/pm.asp"--> <% if StartPageProcessing() Then Response.End() %> <FORM name=thisForm METHOD=post>
This code will be inserted at the end of the file:
<% ' VI 6.0 Scripting Object Model Enabled %> <% EndPageProcessing() %> </FORM>
Figure 4-1. The Properties dialog box for an ASP Web page allows you to enable the SOM.
These two sections of code do several things. First, the pm.asp file is included in the project. This file contains
The run-time properties of the Scripting Object Model do not appear in the Properties window. These properties and
The files for the Scripting Object Model are contained in the _ScriptLibrary folder that Visual InterDev 6
Microsoft is going to replace the JScript files that make up the SOM with a set of components written in C++ using the Active Template Library (ATL). The new Scripting Object Model
Figure 4-2. The _ScriptLibrary folder contains the Scripting Object Model files.
ASP files execute in a linear manner as indicated by Figure 4-3. When a
Figure 4-3. The ASP execution model is sequential from top to bottom.
DHTML pages, on the other hand, execute in an event-driven manner just as Visual Basic applications do. Figure 4-4
Figure 4-4. The DHTML execution model is event-driven.
In Figure 4-4, when a user clicks a hyperlink to this page, the
onload
event will execute when the page loads. The
onclick
event will not execute until the user clicks the command button. This execution model greatly
The Document Object Model of the browser exposes the page as an object hierarchy. The script in the page can execute against the Document Object Model, automating features of the page and making it dynamic. DHTML pages are typically event driven, with code that is contained in event procedures within the page. Of course, you must be using a browser that supports DHTML, such as Microsoft Internet Explorer 4, to use the DHTML features.
The Scripting Object Model works with both DHTML and ASP files. It provides the framework to allow both ASP and DHTML Web pages to execute in an object-oriented manner. Figure 4-5 demonstrates how ASP files have an object model when using the SOM.
You can see the event model of ASP files in Figure 4-5. This new event model is particularly interesting as it allows you to script events for DTCs in either the client or server. Whenever you use the Scripting Object Model, at run-time an object is created for each DTC and the current page. These objects are the mechanism that you use to have access to the features of the page and its DTCs. More on this in a moment.
Figure 4-5. The Visual InterDev 6 Scripting Object Model provides ASP events.
The DTCs' event model is implemented by the Scripting Object Model at run time. This allows you to build events in client or server code. Usage of the new DTCs is covered in detail in Chapter 6. The server events for pages are provided by the PageObject DTC, which is the foundation for page type events and other support for