Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP and VBScrpt, how related?

Status
Not open for further replies.

ChauChiBai

Programmer
May 8, 2002
3
GB
What is the relationship between ASP and VBScript?
For example, If I want to call a sub/function to , say , create a text file containing a recordset , by pressing a button it seems that I am restricted to using a VBScript ButtonName_OnClick subroutine.
I cant use an ASP OnClick subroutine, it is totally ignored. Does that meand that ASP can't use event trapping?

The problem is that VBScript does not include the commands needed to handle database data, and you can't embed ASP commands in a VBScript routine. SO I have to create a new page and pass parameters to it in order to create the file. This seems very inefficient and increases the number of pages required to create a web site.

Any advice would be greatly appreciated.

Regards
JohnR
 
Server side code cannot trap client side events, hence the need for client side script such as vbscript and javascript. How asp usually works is vbscript or javascript is used as the client side scripting language to validate data and handle events on the client browser. Whatever information is then sent to the server through the querystring or thru the form object. Once this data reaches the server you can then use VB to process that data.
 
The thing to remember is that ASP is a technology, VBScript is a language. ASP can use several languages, including VBScript. JScript and Perlscript.

ASP, whatever language, takes place at the server, whereas a button onClick (or any other such event) is client side, using client side scripts in Javascript or VBscript. In order to invoke a server side routine, the client must contact the server and request the action. In order to do this you need to call for an action (new page) and post data to it (from a form, using post or get, or a querystring).

A page can call itself in this way and process data passed from itself, which will obviously reduce the number of pages, but can lead to complex pages.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top