Page #67 (Chapter 9 - Dealing with Multiple Browsers)

Chapter 9 - Dealing with Multiple Browsers

Visual Basic Developers Guide to ASP and IIS
A. Russell Jones
  Copyright 1999 SYBEX Inc.

Writing Code with Code
You did add one new tool in the last two projects; you're using server-side code to write client-side code. The message box and the alert scripts run entirely on the client.
The ability to write code with code is not only interesting, but also powerful. If you've ever written a Visual Basic add-in, then you'll immediately understand the time you can save by automating common tasks. One common task is writing client-side scripts, many of which are repetitive and lend themselves to automation. You can write dynamic scripts easily by using tag replacement or by wrapping the code to generate the scripts in a function. You can pass parameters to these script-automation functions to create page-specific scripts. This capability is especially useful when your project work is split between HTML/layout artists and programmers, who can then insert scripts as needed to act on the various objects on the page.
You should be aware that you can write not only client-side code with WebClasses, but also server-side code in the form of ASP or HTML files. You've already seen how to create an ASP file that rewrites itself. You can extend this capability with WebClasses. If certain portions of your application need to change often, you can write the ASP files by using information collected by the WebClass.
For example, suppose your application generates a complex report. The database queries may take several minutes. Unless the report needs to be up to the minute, you can cache it by writing an HTML or ASP page that contains the result of the first report request. Having generated the page for one request, you can simply return the generated page for subsequent requests. You can use a hidden date field or a database query to determine when you need to refresh the report.



Visual Basic Developer[ap]s Guide to ASP and IIS
Visual Basic Developer[ap]s Guide to ASP and IIS
ISBN: 782125573
EAN: N/A
Year: 2005
Pages: 98

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net