我怎样才能运行更新面板刷新后,一些javascript? [英] How can I run some javascript after an update panel refreshes?
问题描述
我有一个pageLoad函数中它设置上的.ascx控制,我不能改变一些CSS。在页面加载一切都很好,但是当一个更新面板更新控制,不再应用我的CSS。我怎样才能重新运行我的功能页面更新后?
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?
$(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?
推荐答案
添加add_pageLoaded处理也可以正常工作。
Adding an add_pageLoaded handler can also work.
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoadedHandler);
请注意:处理程序将会触发任何回调,但可以使用 sender._postBackSettings.panelID
过滤,当你想叫你的函数
Note: the handler will fire for any callback, but you can use sender._postBackSettings.panelID
to filter when you want your function called.
更多样本:
- http://blog.jeromeparadis.com/2007/03/01/1501 /
- http://zeemalik.word$p$pss.com/2007/11/27/how-to-call-client-side-javascript-function-after-an-updatepanel-asychronous-ajax-request-is-over/
- 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/
这篇关于我怎样才能运行更新面板刷新后,一些javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!