sending JavaScript code from server control to client ???

Discussion in 'ASP .Net' started by Oney, May 12, 2004.

  1. Oney

    Oney Guest

    How can I send a javascript code from an asp server control to client
    and run that script on client
    for example;
    when an asp server button clicked, an alert javascript must be sent to
    client and run on the client
    how can I do that?

    please send an example if possible,

    thank you very much!
     
    Oney, May 12, 2004
    #1
    1. Advertisements

  2. Oney

    Curt_C [MVP] Guest

    Response.Write()

    If you have something like that though this will not execute until the page
    is completly renedered to the client. There is no way to "pause and wait"
    for something from the client, WWW is not designed this way.
     
    Curt_C [MVP], May 12, 2004
    #2
    1. Advertisements

  3. string s = "<script type=\"text/javascript\">alert(\"This is an
    alert!\");</script>";
    if (!(Page.IsStartupScriptRegistered("AlertScript")))
    Page.RegisterStartupScript("AlertScript", s);

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.
     
    Kevin Spencer, May 12, 2004
    #3
    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.