Discussion in 'ASP General' started by JT, Jul 19, 2004.

  1. JT

    JT Guest

    im trying to use the MsgBox function in the following to display an ASP
    MsgBox containing text retrieved from the db into a recordset

    set rsMessages= myRecordset
    msg_text = rsMessages.Fields("msg_text")

    this generates a permission denied error b/c msgbox needs to run client side
    so i tried the same code but used


    in place of the <% %> tags

    but now i just get an empty message box

    i must be misunderstanding something with the way the msgbox function works
    in terms of client side vs server side.

    any help would be much appreciated

    JT, Jul 19, 2004
    1. Advertisements

  2. Aaron [SQL Server MVP], Jul 19, 2004
    1. Advertisements

  3. JT

    Ray at Guest

    Well, you understand server-side vs. client-side. Now all you have to do is
    bridge the two together. You want to use a msgbox, which MUST take place in
    the client environment, but you want to display data that is available in
    the server-side environment. So, you need to pass the server-side value to
    something that the client can see. Here's how to do that.

    '''server side code
    set rsMessages= myRecordset
    msg_text = rsMessages.Fields("msg_text")

    <script language="vbscript">
    ''client side code
    msgbox "<%=msg_text%>"

    You'll notice when you load the page and view source, the client-side script
    will have the literal value of msg_text the same way that it would if you
    just put something like <td><%=msg_text%></td> somewhere.

    BTW, client-side vbscript is pretty much ill-advised...

    Ray at work
    Ray at, Jul 19, 2004
  4. JT

    Rob Collyer Guest

    maybe i mis-understand you, but if you are trying to generate a msgbox
    with SERVER side code (on the server), then you';ll be at it forever....
    it cant be done with JUST asp.
    Rob Collyer, Jul 19, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.