asp.net中使用 UpdatePanel 回传导致js 失效解决办法

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
     <input src="../../../images/ico/ico_delete.gif" onload="reBindDatepicker()" style="display: none" id="Image1" type="image" />
 </ContentTemplate>
</asp:UpdatePanel>

<script type="text/javascript"> function reBindDatepicker() { $(document).ready(function() { //... }); } </script>

 

注意: src 地址要写正确

 ----------------

第二种方法:

$(document).ready(function() {
    // bind your jQuery events here initially
});

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_endRequest(function() {
    // re-bind your jQuery events here
});


the solution is from :

http://stackoverflow.com/questions/256195/jquery-document-ready-and-updatepanels

 

posted @ 2013-10-14 17:48  shzy2012  阅读(1423)  评论(0编辑  收藏  举报