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. Advertising

  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 Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Oney" <> wrote in message
    news:...
    > 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!
     
    Curt_C [MVP], May 12, 2004
    #2
    1. Advertising

  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.

    "Oney" <> wrote in message
    news:...
    > 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!
     
    Kevin Spencer, May 12, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    1
    Views:
    7,105
    Scott M.
    Oct 11, 2003
  2. nick
    Replies:
    3
    Views:
    3,246
    Eliyahu Goldin
    Dec 15, 2004
  3. -
    Replies:
    2
    Views:
    448
    Alan Krueger
    Jul 29, 2005
  4. Luke
    Replies:
    2
    Views:
    4,812
    Nigel Wade
    Mar 15, 2007
  5. Renuka
    Replies:
    1
    Views:
    129
    Michael Winter
    Nov 13, 2003
Loading...

Share This Page