Server Side Control to call javascript

How do I call javascript from a server side event.

For example if a user ticks a checkbox, rather than running some server code it runs javscript instead.
LVL 3
Kevin RobinsonPrivate VB.NET ContractorAsked:
Who is Participating?
 
HouseMusicConnect With a Mentor Commented:
If you dont want to reload the client page you have to implement a callback

Your page has to imlement system.web.ui.icallbackeventhandler


I was going to post a bit of code, but it would require too much explanation.

try here -->   http://msdn2.microsoft.com/en-US/library/ms178208.aspx


wait.. I reread your post... If a user ticks a checkbox, thats a client side event, not a server side one ... just do like Desp said.

0
 
Fahad MukhtarDistinguished EngineerCommented:
CheckBox1.Attributes.Add("OnClick", "alert('Client side code');")
0
 
Kevin RobinsonPrivate VB.NET ContractorAuthor Commented:
Yes you are right. Doh!

"If a user ticks a checkbox, thats a client side event, not a server side one "
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.