jqueryasp.netpaginationdatapager

Jquery code doesn't work after paging?


i have written below code in my content page which has listview and datapager

    <asp:Content ID="content2" runat="server" ContentPlaceHolderID="HeadContent">
    <link href="../js/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />

    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.1.js" type="text/javascript"></script>

    <script src='<%=ResolveClientUrl("~/js/fancybox/jquery.fancybox-1.3.4.js")%>' type="text/javascript"></script>

    <script src='<%=ResolveClientUrl("~/js/fancybox/jquery.easing-1.3.pack.js")%>' type="text/javascript"></script>

    <script src='<%=ResolveClientUrl("~/js/fancybox/jquery.mousewheel-3.0.4.pack.js")%>'type="text/javascript"></script>

    <script type="text/javascript"> 
     $(document).ready(function () { 
   $(".fancyYoutube").fancybox({ 
             'transitionIn': 'elastic',
             'transitionOut': 'fade',
             'width': 680,
             'height': 495,
             'type': 'swf'
             }); 
            });
    </script>
</asp:Content>

This works fine.. but when i do paging then code written doesn't work.

I could see that in visual studio one file is created 'Jscript-window script block'. and code written

__doPostBack('ctl00$BodyContent$lvEnglishMovieList$dpgGallery$ctl01$ctl01','')

What does this mean??


Solution

  • Issue solved.

    <script type="text/javascript">
        $(document).ready(function () {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(showtrailer);
            showtrailer();
        });
        function showtrailer() {
            $(".fancyYoutube").fancybox({
                'transitionIn': 'elastic',
                'transitionOut': 'fade',
                'width': 680,
                'height': 495,
                'type': 'swf'
            });
        }
    </script>
    

    My listview was inside the update panel becuase of which i had to write these code. Got help from asp.net forum and the link is HERE