Saturday, April 16, 2011

4 ways to solve UpdatePanel and JQuery problem

Solution 1:

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function() {
    // re-bind your jquery events here
});

 Solution 2:
<ContentTemplate>
     <script type="text/javascript">
                    Sys.Application.add_load(BindEvents);
     </script>
 *// Staff*
</ContentTemplate>

Solution 3: 
$(function() {
    $('div._Foo').live("mouseover", function(e) {
        // Do something exciting
    });
});

Solution 4: 
<asp:UpdatePanel runat="server" ID="myUpdatePanel">
    <ContentTemplate>
 
        <script type="text/javascript" language="javascript">
        function pageLoad() {
           $('div._Foo').bind("mouseover", function(e) {
               // Do something exciting
           });
        }
        </script>
 
    </ContentTemplate>
</asp:UpdatePanel>




No comments:

Post a Comment