I need the ability to temporarily turn off the partial page update behavior for an ASP.NET Ajax / UpdatePanel based page. (The reason is to circumvent the issue where IE blocks "automatic file downloads" for downloads generated as a result of this postback, but I don't want to distract from my original question)
我需要能够暂时关闭基于ASP.NET Ajax / UpdatePanel的页面的部分页面更新行为。 (原因是为了避免IE阻止因自动回复而生成的下载“自动文件下载”的问题,但我不想分散我原来的问题)
I looked at the client side javascript libraries hoping to find a switch somewhere. I think a solution might involve using javascript to override the 'onclick' event handler for the control that acts as the trigger, and then calling "submit" on the form itself..
我查看了客户端javascript库,希望在某处找到一个开关。我认为一个解决方案可能涉及使用javascript覆盖作为触发器的控件的'onclick'事件处理程序,然后在表单本身上调用“submit”。
Also, using the EnablePartialRendering property on the server-side ScriptManager control won't work because that is done when the page is being built. I need to be able to do this as a result of switching a drop down list box.
此外,在服务器端ScriptManager控件上使用EnablePartialRendering属性将不起作用,因为这是在构建页面时完成的。我需要能够通过切换下拉列表框来执行此操作。
Any ideas?
Cheers!
/ Sean
2 个解决方案
#1
Well, after much trial and error, I found two approaches that seemed to work:
好吧,经过多次反复试验,我发现了两种似乎有效的方法:
- Use Javascript to manually submit the top level form associated with the page. This usually has the ID of "form1".
- Create a button that is outside of any UpdatePanels and use Javascript to click the button.
使用Javascript手动提交与页面关联的*表单。这通常具有“form1”的ID。
创建一个位于任何UpdatePanel之外的按钮,并使用Javascript单击该按钮。
I wound up using the second approach, since it allowed me to handle the event with a specific routine without the need to guess that my postback came from a Javascript call.
我使用第二种方法结束了,因为它允许我使用特定例程处理事件,而不需要猜测我的回发来自Javascript调用。
This is an example of the code that performed the postback:
这是执行回发的代码示例:
...
if (isDownload) {
document.getElementById('FullPostbackSubmitter').click();
return;
}
...
Hope this helps someone else!
希望这有助于其他人!
#2
You can set the EnablePartialRendering
property of your ScriptManager to false
.
您可以将ScriptManager的EnablePartialRendering属性设置为false。
#1
Well, after much trial and error, I found two approaches that seemed to work:
好吧,经过多次反复试验,我发现了两种似乎有效的方法:
- Use Javascript to manually submit the top level form associated with the page. This usually has the ID of "form1".
- Create a button that is outside of any UpdatePanels and use Javascript to click the button.
使用Javascript手动提交与页面关联的*表单。这通常具有“form1”的ID。
创建一个位于任何UpdatePanel之外的按钮,并使用Javascript单击该按钮。
I wound up using the second approach, since it allowed me to handle the event with a specific routine without the need to guess that my postback came from a Javascript call.
我使用第二种方法结束了,因为它允许我使用特定例程处理事件,而不需要猜测我的回发来自Javascript调用。
This is an example of the code that performed the postback:
这是执行回发的代码示例:
...
if (isDownload) {
document.getElementById('FullPostbackSubmitter').click();
return;
}
...
Hope this helps someone else!
希望这有助于其他人!
#2
You can set the EnablePartialRendering
property of your ScriptManager to false
.
您可以将ScriptManager的EnablePartialRendering属性设置为false。