AsyncPostBackTrigger 不适用于同时更新调用
我有一个包含一些 UpdatePanel 的页面,每个 UpdatePanel 都有自己的更新按钮。由于更新例程可能需要一些时间,因此我认为将它们设为异步将有助于逐步加载页面。
但是这样做,当我以编程方式触发每个面板的更新例程时,我只更新了最后一个 UpdatePanel。
下面是一个代码示例,其中包含两个 UpdatePanel。要求必须在客户端 pageLoad 函数上触发更新例程。
这是一个错误还是我在代码中遗漏了某些内容?
谢谢=)
<asp:UpdatePanel ID="Panel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="Text1" runat="server" />
<asp:Button ID="Button1" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="Panel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="Text2" runat="server" />
<asp:Button ID="Button2" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
和客户端代码:
function pageLoad()
{
$('#Button1').click();
$('#Button2').click();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原因如下:
http://www.asp.net/ajax/documentation/live/ Tutorials/ExclusiveAsyncPostback.aspx
这是一个解决方案:
处理多个异步回发
Here is why:
http://www.asp.net/ajax/documentation/live/tutorials/ExclusiveAsyncPostback.aspx
Here is a solution:
Handling Multiple Asynchronous Postbacks