Asp.Net Execute Javascript in an Update Panel

Posted on 2009-02-17
Last Modified: 2012-05-06

i want to execute Javascript in an Update Panel.

<update panel 1 />
<update panel 2 />

if the panel 2 sends an callback, some javascript should be shown.

i'm using
best regards
Question by:Rockfabrik
    1 Comment
    LVL 18

    Accepted Solution

    I dont know if you have many trigger to the update panel 2, but you could use something like on this one.
    the intersting part is there :
    <script type="text/javascript">
    function(sender, e)
    if (e.get_postBackElement().id == "<%= GridView1.ClientID %>") // This line can make sure only the request from GridView1 will present popup panel, you can change it to other control client id.

    it run a script at each postback and it check the postBackElement().id to show the popup. so you could replace the $find('modalbehavior').show(); with your script and "<%= GridView1.ClientID %>")  with all the control that trigger the update (The all the control part may be a problem to you...  )

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    There is basically two types of AJAX request in mootools. Request  and Request.HTML Request: Request is the basic XHR request class in MooTools. While not extremely useful on its own, it provides the basic functionality for both Request.HTM…
    Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    745 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

    17 Experts available now in Live!

    Get 1:1 Help Now