sending JavaScript code from server control to client ???

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!
 
C

Curt_C [MVP]

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

Kevin Spencer

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top