如何在更新面板刷新之后运行一些javascript ?
I have a pageLoad function which sets some css on an .ascx control that I cannot change. On page load everything is fine, but when an update panel updates the control, my css is no longer applied. How can I rerun my function after the page updates?
我有一个pageLoad函数,它在.ascx控件上设置一些css,我无法更改。在页面加载时,一切正常,但是当更新面板更新控件时,我的css将不再被应用。如何在页面更新后重新运行我的函数?
$(function() {
$("textarea").attr("cols", "30");
$("input.tbMarker").css({ "width": "100px" }).attr("cols","25");
});
This obviously only runs on the initial page load. How can I run it after an update?
这显然只在初始页面加载时运行。更新后如何运行它?
5 个解决方案
#1
38
Adding an add_pageLoaded handler can also work.
添加一个添加了页面的处理程序也可以工作。
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoadedHandler);
Note: the handler will fire for any callback, but you can use sender._postBackSettings.panelID
to filter when you want your function called.
注意:处理程序将会触发任何回调,但是您可以使用sender._postBackSettings。当需要调用函数时,可以使用panelID进行筛选。
More samples:
更多的样本:
- http://blog.jeromeparadis.com/2007/03/01/1501/
- http://blog.jeromeparadis.com/2007/03/01/1501/
- http://zeemalik.wordpress.com/2007/11/27/how-to-call-client-side-javascript-function-after-an-updatepanel-asychronous-ajax-request-is-over/
- http://zeemalik.wordpress.com/2007/11/27/how-to-call-client-side-javascript-function-after-an-updatepanel-asychronous-ajax-request-is-over/
更多相关文章
- 使用jQuery.ajax post函数将javascript数组中的数据传递给服务器
- 重写ajax方法实现异步请求session过期时跳转登录页面
- TypeError:e。getPosition不是一个函数。
- [jquery]如何实现页面单块DIV区域滚动展示
- 基于Jquery ui 可复用的酒店 web页面选择入住日期插件
- 在ASPX页面中使用webmethod服务AJAX请求。
- JQuery Mobile 手机显示页面偏小
- jquery的$.alerts.alert怎么实现点击后跳转页面
- 记录前台页面一些jQuery笔记