UpdatePanel异步刷新要用到的几个控件:
1.ScriptManager
2.UpdatePanel
3.UpdateProgress
解决异步刷新后js失效的2种方法:
1.后台重新注册JS方法
ScriptManager.RegisterStartupScript(Page, typeof(string), "Sort", "Fun_Sort();", true);
Fun_Sort()为要前台重新注册的js方法。
2.使用Sys.WebForms.PageRequestManager 类重新注册方法
<script type="text/javascript" language="javascript">
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
var elem = args.get_postBackElement();
}
function EndRequestHandler(sender, args) {
$(function () {
$('#example').dataTable({
"bPaginate": false,
"bFilter": false,
"bInfo": false,
"aoColumns": [{ "bSortable": true }, { "bSortable": true }, { "bSortable": true }, { "bSortable": true }, { "bSortable": true }, { "bSortable": true }, { "bSortable": false}]
});
});
}
</script>
转载于:https://www.cnblogs.com/HappySpring/archive/2013/04/17/3026000.html