Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

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.
0
Kevin Robinson
Asked:
Kevin Robinson
1 Solution
 
Fahad MukhtarDistinguished EngineerCommented:
CheckBox1.Attributes.Add("OnClick", "alert('Client side code');")
0
 
HouseMusicCommented:
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
 
Kevin RobinsonAuthor Commented:
Yes you are right. Doh!

"If a user ticks a checkbox, thats a client side event, not a server side one "
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now