自动提交UpdatePanel并显示UpdateProgress区域
我想自动提交表单并在提交后显示更新进度区域。我厌倦了向页面添加 2 个功能:
window.onload=function(){
__doPostBack('UpdatePanelId','');
}
并且......
window.onload=function(){
var btn = document.getElementById('buttonID');
btn.click();
}
页面被发布回,但进度区域没有显示。我有什么想法可以处理这个问题吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据您的进一步评论:
您在该面板之外有一个
UpdatePanel
和SomeUploadControl
。当您从SomeUploadControl
引发完整回发时,您希望显示UpdateProgress
。如果上述假设是正确的 - 恐怕你不能做你想做的事。
UpdateProgress
背后的整个想法是处理部分回发。我很确定上面的内容是正确的,但我可能是错的。
根据您的评论进行编辑:)
尝试:
如果这不起作用 - 提供有关您试图解决的问题的更多详细信息(为什么您试图通过javascript引起回发),并且可能有更好的方法。
Based on your further comments:
you have an
UpdatePanel
andSomeUploadControl
outside of that panel. You want to showUpdateProgress
when you cause a FULL POSTBACK fromSomeUploadControl
.If the above assumptions are correct - I'm afraid you can't do what you want. The whole idea behind the
UpdateProgress
is to work on PARTIAL POSTBACKS.I'm pretty sure the above is correct, but I might be mistaken.
Edited in light of your comment :)
try:
if this doesn't work - give more details on the problem you're trying to solve (why are you trying to cause the postback via javascript), and there might be a better way altogether.
我已经开始工作了!!
最初,我的脚本在 ScriptManager 客户端脚本块内运行。我将其移到脚本管理器之外,并向脚本添加了超时。它看起来是这样的:
I got it to work!!
Origianlly, I had my script running inside the ScriptManager client script block. I moved it outside of the script manager and added a timeout to the script. Here is what it looks like: