Javascript 回发后未调用pageload()

Javascript 回发后未调用pageload(),javascript,jquery,asp.net,webforms,Javascript,Jquery,Asp.net,Webforms,回发邮件后,我的div“attachements”没有刷新,并且没有调用pageLoad() <div id ="attachments"> <asp:UpdatePanel ID="updtPnlAttachements" runat ="server" > <ContentTemplate> <asp:GridView ID="gvAttachments" runat="server" ClientIDMode

回发邮件后,我的div“attachements”没有刷新,并且没有调用pageLoad()

    <div id ="attachments">
<asp:UpdatePanel ID="updtPnlAttachements" runat ="server"  >

    <ContentTemplate>
         <asp:GridView ID="gvAttachments" runat="server"  ClientIDMode = "Static"   Width ="100%">
           <Columns>


           </Columns>
           <EmptyDataTemplate>
           <div> Sorry Empty</div>
           </EmptyDataTemplate>               
         </asp:GridView>

     </ContentTemplate>

</asp:UpdatePanel>
我的脚本是这样的

       function pageLoad() {var totalRows = $("#<%=gvAttachments.ClientID %> tr").length;

    if (totalRows > 0) {

        $("#dialog:ui-dialog").dialog("destroy");

        $("#attachments").dialog({
            hide: "fold",
            show: "blind",
            height: 500,
            width: 800,
            modal: true
        });
    }

    $('#gvNcReports').dataTable({
        "bJQueryUI": true,
        "sPaginationType": "full_numbers"
    });
}`
函数pageLoad(){var totalRows=$(“#tr”).length;
如果(总计行数>0){
$(“#dialog:ui dialog”).dialog(“销毁”);
$(“#附件”)。对话框({
隐藏:“折叠”,
表演:“盲人”,
身高:500,
宽度:800,
莫代尔:对
});
}
$('#gvNcReports')。数据表({
“bJQueryUI”:没错,
“sPaginationType”:“完整编号”
});
}`
任何建议。谢谢

*更新**

我有多个更新面板,一旦我删除它们,它就工作了

试试看:

using Sys.Application.add_load(function(sender, e) {

});
看看这是否有区别。当更新面板请求结束时,您还可以使用:

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function(sender, e) {

});

HTH.

II最终将此添加到页面加载中,并且可以正常工作

 string script = @"<script> 
                   function pageLoad() {
                    $('#gvNcReports').dataTable({
                      "bJQueryUI": true,
                      "bPaginate": false
                            });
                   $("#dialog:ui-dialog").dialog("destroy");
                   $("#updtPnlAttachements").dialog({
                    hide: "fold",
                    show: "blind",
                    height: 500,
                    width: 800,
                    modal: true
                   });
                }
                });</script>";

 Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"hover",script);
string脚本=@”
函数pageLoad(){
$('#gvNcReports')。数据表({
“bJQueryUI”:没错,
“bPaginate”:错误
});
$(“#dialog:ui dialog”).dialog(“销毁”);
$(“#updtpnlatachments”)。对话框({
隐藏:“折叠”,
表演:“盲人”,
身高:500,
宽度:800,
莫代尔:对
});
}
});";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),“hover”,脚本);

但是,我仍然需要添加$(document)。准备好了吗?在标题中添加相同的脚本以确保在最初呈现时一切正常,这是一种不好的做法吗?

我没有看到在任何地方调用函数
pageLoad
。。。这可能是你的问题吗?
 string script = @"<script> 
                   function pageLoad() {
                    $('#gvNcReports').dataTable({
                      "bJQueryUI": true,
                      "bPaginate": false
                            });
                   $("#dialog:ui-dialog").dialog("destroy");
                   $("#updtPnlAttachements").dialog({
                    hide: "fold",
                    show: "blind",
                    height: 500,
                    width: 800,
                    modal: true
                   });
                }
                });</script>";

 Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"hover",script);