Execute code on page load

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Execute code on page load

    I can code that I want to execute on page load (code includes asp insert data
    into tables) DWMX behaviours insert on submit. Can anyone put me on the right
    track to executing the asp code on a page before the page loads so I dont have
    to use a submit button?

    Shmooter Guest

  2. Similar Questions and Discussions

    1. error, mapping htm files execute cfm code
      Hello, I followed this technote to configure the web server so he can execute coldfusion code in htm files :...
    2. Execute code on session end
      I would like to pop up a message to the user when the session is about to time out. And if they don?t respond I would like to update a database just...
    3. User control code behind does not execute
      Anybody have any ideas as to why my user control code will not execute the server side code? I converted an .aspx page to an .ascx user control. ...
    4. execute javascript from php code
      How can I execute a javascript file(test.js) from within PHP. I'm running oscommerce and want to insert a menu created in javascript by Sothink...
    5. How can I execute code stored in variable
      > Something like ***execute()***, but instead of executing shell oops! By execute() I meant exec() or passthru(). It was very late when I...
  3. #2

    Default Re: Execute code on page load

    <%
    'cn represents your connection object
    cn.execute "insert into Table(ColName1,ColName2) values(Val1,Val2)"
    %>
    <html>
    </html>

    Just place a code block with the script you want to execute at the top of
    the page and it will be executed first. The built-in behaviors are nice, but
    they're not very flexible. The execute method can be used to fire your SQL
    in one line. Check out [url]www.asp101.com[/url] for some basic tutorials. Learning to
    write ASP, and just about any other scsripting language isn't all that hard.
    The sooner you get started, the more powerful and flexible your applications
    will be.

    However, something you might want to consider is jumping in to ASP.NET,
    since classic ASP is being replaced. In an ASP.NET example you would use a
    DataAdapter to fire your SQL statement in the Page_Load sub...

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    do SQL here

    End Sub

    HTH,
    Brandon

    "Shmooter" <webforumsuser@macromedia.com> wrote in message
    news:d5p6k5$mtv$1@forums.macromedia.com...
    >I can code that I want to execute on page load (code includes asp insert
    >data
    > into tables) DWMX behaviours insert on submit. Can anyone put me on the
    > right
    > track to executing the asp code on a page before the page loads so I dont
    > have
    > to use a submit button?
    >

    Brandon Taylor Guest

  4. #3

    Default Re: Execute code on page load

    You could use the Command behaviour.

    --
    Jules
    [url]http://www.charon.co.uk/charoncart[/url]
    Charon Cart 3
    Shopping Cart Extension for Dreamweaver MX/MX 2004


    Julian Roberts Guest

  5. #4

    Default Re: Execute code on page load

    How exactly who I use the Command Behaviour.....any texts or tuts as to how i can implement your suggestion?
    Shmooter Guest

  6. #5

    Default Re: Execute code on page load

    Put the SQL into the Command behaviour, eg

    insert into myTable (myField) values ('foo')

    --
    Jules
    [url]http://www.charon.co.uk/charoncart[/url]
    Charon Cart 3
    Shopping Cart Extension for Dreamweaver MX/MX 2004


    Julian Roberts Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139