ASP.NET ajax to change LinkButton dynamically

Posted on 2011-05-04
Last Modified: 2012-05-11
Can the LinkButton or the like in ASP.NET dynamically change onClick event with Ajax? and at the same time, on the server side, it should updates the value of certain record in the database.
How do I achieve this?
Question by:luisr69
    LVL 8

    Expert Comment

    Can you provide an example?

    Author Comment

    I need an example if possible.
    LVL 81

    Accepted Solution

    Yes, you can capture the click on a LinkButton or any other controls
    For example with jQuery (where LinkButton1 is the ID of your control) :

    $("<%= LinkButton1.CliendID %>").click(function(e) {
        // code to update value in the database with Ajax (PageMethods for example)

    An article about PageMethods :
    jQuery and :

    Author Closing Comment

    It got me started, Thanks
    LVL 81

    Expert Comment

    You're welcome! Thanks for the points! Have a nice week-end!

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
    Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    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.

    746 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

    14 Experts available now in Live!

    Get 1:1 Help Now