sending JavaScript code from server control to client ???

  • Thread starter Thread starter Oney
  • Start date Start date
O

Oney

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!
 
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.
 
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.
 
Back
Top