Implementing a Design-time Control in an ASP
In this exercise, you will use the Data Connection design-time control in an Active Server Page.
* To implement a design-time control
- Start a new Web Project in Visual InterDev and name it Employees .
- Save it in WA\Practice\Ch10\employees .
- Leave the servername localhost and click Next .
- Leave the default name, Employees and click Finish .
- A valid data source name needs to be first associated with this project. Right-click the project in the FileView window and click Add Data Connection .
- Click the Machine Data Source tab, select nwind , and then click OK .
- Review the default connection information. The name of this data connection will be DataConn .
- Close the Data Connection Properties window.
- Add a new ASP page named default.asp .
- Delete the HTML comment.
- Right-click between the BODY tags and click Insert HTML Using Wizard .
- Select the Data Range Wizard and click OK .
- Select Show only and specify two records at a time and click Next .
- Leave the default data range name and click Finish .
- The Properties dialog will appear. In the Data Connection box, select DataConn .
- In the Command Text box, type Select * From Employees .
- Click Copy Fields .
- Add the EmployeeID , FirstName , and LastName fields to the Fields to Copy list and click OK .
The VBScript to display these fields has been copied to the clipboard. You can then paste the script into the appropriate location on the Web page.
- Close the Properties box.
- Close the Design-Time control window.
- Place the insertion point before the second instance of this line of code:
<!--METADATA TYPE="DesignerControl" startspan
- Right-click the page and click Paste .
* To test the application - From the FileView window, right-click default.asp and click Preview in Browser .
- Click Yes if prompted to save your changes.
- Test the navigation buttons on the page.
- Exit Microsoft Visual InterDev.
Lesson Summary
ActiveX design-time controls are tools that write server-side script, client script, or HTML using applications such as Microsoft Visual Basic or JavaScript. You can use existing ActiveX controls, or you can author your own design-time controls using Visual Basic. Microsoft Visual InterDev provides design-time controls that add functionality to your programs.