Results 1 to 4 of 4

Thread: "runat=server" question

  1. #1
    Join Date
    Dec 2005

    "runat=server" question

    I have written several "classic asp" pages with VBScript and JavaScript code and want to know when I should be using the "runat=server" command.

    I know that asp means "server pages" so I am a bit confused on the "runat" statement.

  2. #2
    Join Date
    Dec 2003
    England, UK
    i believe that <script runat="server"> is the same as writing <%, but apparently you aren't supposed to mix them because the code blocks might not run in the expected order.

  3. #3
    Join Date
    Jan 2003
    Yes I believe as long as you use VBScript server-side and JavaScript client-side (i.e. the defaults) you probably won't even have to use that.

    And it's easy to use the value of a VBScript variable in JavaScript:
    document.writeln('<%= MyVBScriptVariable %>');

    It's also easy to use the value of a VBScript function in javascript:
    document.writeln('<%= MyVBScriptFunction() %>');

    Or here is an example which puts the value of a VBScript variable into a JavaScript alert box:
    Response.Write "<script language='JavaScript'>alert('The value is " & MyVBScriptVariable & "');</script>"
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  4. #4
    Join Date
    Mar 2006
    i believe runat describes a control that is run on the server side ...aka if you want a drop down list that requires the database to query what the items in that list are, then you need to use runat...else the control doesnt have to connect to the server to find out...i think when u use runat, it establishes a connection...which in turn uses bandwidth. If it was done without runat=server...then it would be built into the control and the database would not need to be accessed...

    i think the question here is...do we need to store everything in the database (which could slow down the database in some cases) or do we only store info that gets updated regularily in the database (and use the runat=server for those)....

    im still new to this...i may be wrong..lol. =] or i may have misunderstood the question..lol.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles