jQuery $(document).ready and UpdatePanels?

Posted by Herb Caudill on Stack Overflow See other posts from Stack Overflow or by Herb Caudill
Published on 2008-11-01T22:24:34Z Indexed on 2010/05/26 20:01 UTC
Read the original article Hit count: 217

Filed under:
|
|

I'm using jQuery to wire up some mouseover effects on elements that are inside an UpdatePanel. The events are bound in $(document).ready . For example:

$(function() {

    $('div._Foo').bind("mouseover", function(e) {
        // Do something exciting
    });

});

Of course, this works fine the first time the page is loaded, but when the UpdatePanel does a partial page update, it's not run and the mouseover effects don't work any more inside the UpdatePanel.

What's the recommended approach for wiring stuff up in jQuery not only on the first page load, but every time an UpdatePanel fires a partial page update? Should I be using the ASP.NET ajax lifecycle instead of $(document).ready?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery