Server Side Control to call javascript

Posted on 2006-05-19
Last Modified: 2010-04-23
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.
Question by:Kevin Robinson
    LVL 19

    Expert Comment

    CheckBox1.Attributes.Add("OnClick", "alert('Client side code');")
    LVL 3

    Accepted Solution

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

    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.

    LVL 3

    Author Comment

    by:Kevin Robinson
    Yes you are right. Doh!

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    This video discusses moving either the default database or any database to a new volume.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now