如何在更新面板刷新后执行 JavaScript(无法让 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(); 工作)
我试图在更新面板刷新后运行 JavaScript。我读过一些地方,您可以使用与此类似的代码:
function codeToRun() {
//Code Here
}
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(codeToRun);
但它似乎不起作用......有什么想法吗?我尝试将代码放在更新面板的内容区域内部以及外部......到目前为止还没有任何运气。如果您对为什么会发生这种情况有任何见解,请告诉我。
谢谢,
马特
I'm trying to run javascript once an update panel has refreshed. I've read a few places that you can use code similar to this:
function codeToRun() {
//Code Here
}
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(codeToRun);
But it doesn't seem to be working... any ideas? I've tried putting the code inside the Content area of the update panel as well as outside of it... haven't had any luck so far. Please let me know if you have any insight to why this might be happening.
Thanks,
Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一切都需要在 UpdatePanel 之外:
标记:
脚本:
Everything needs to be outside of the UpdatePanel:
Markup:
Script:
对 System.WebForms.PageRequestManager 的调用应该在包含并初始化库之后进行,但可能不在 UpdatePanel 内部。
The call to
System.WebForms.PageRequestManager
should come after the library has been included and initialized, but probably not inside the UpdatePanel.