设置 AssociatedUpdatePanelID 时 Updateprogessbar 不起作用?
我的页面上有两个更新面板和一个进度条。 如果我设置 AssociatedUpdatePanelID,则进度条无法工作,如果不设置 AssociatedUpdatePanelID,进度条可以工作,但问题适用于两个 updatepanel。 但我需要在一个更新面板上工作。
<asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Button2" OnClick="Button2_Click" />
<asp:UpdateProgress runat="server" ID="prg" AssociatedUpdatePanelID="upnl">
<ProgressTemplate>
<img src="Images/progressbar.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
<br />
<asp:UpdatePanel runat="server" ID="upnl" UpdateMode="Conditional">
<ContentTemplate>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="upnl1" UpdateMode="Conditional">
<ContentTemplate>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Code Behind - C#
protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
}
protected void Button2_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
}
在这个视频中,他也没有设置 AssociatedUpdatePanelID http://www.asp.net/learn/ajax-videos/ video-123.aspx
I have two updatepanel and a progressbar on the page. If I set the AssociatedUpdatePanelID, then progressbar is not working, without setting AssociatedUpdatePanelID progress bar is working but the problem is working for both updatepanel. But I need to work on one updatepanel.
<asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Button2" OnClick="Button2_Click" />
<asp:UpdateProgress runat="server" ID="prg" AssociatedUpdatePanelID="upnl">
<ProgressTemplate>
<img src="Images/progressbar.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
<br />
<asp:UpdatePanel runat="server" ID="upnl" UpdateMode="Conditional">
<ContentTemplate>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="upnl1" UpdateMode="Conditional">
<ContentTemplate>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Code Behind - C#
protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
}
protected void Button2_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
}
In this video, he also not set AssociatedUpdatePanelID
http://www.asp.net/learn/ajax-videos/video-123.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
优秀文章:以非常简单的方式解释每件事......................
http://www.codedigest.com/Articles/ASPNETAJAX/125_Using_UpdateProgress_Control_Effectively.aspx
根据设计,UpdatePanel 的外部触发器不会触发关联的 UpdateProgress,因为启用 UpdateProgress 控件的实现会在控件层次结构中搜索调用控件; 外部触发器不会出现在控制层次结构中。
Excellant Article: Explaining every thing in very simple manner..........
http://www.codedigest.com/Articles/ASPNETAJAX/125_Using_UpdateProgress_Control_Effectively.aspx
By Design External triggers for an UpdatePanel do not fire an associated UpdateProgress, since the implementation of enabling the UpdateProgress control searches the control hierarchy for the calling control; an external trigger will not be present in the control hierarchy.
如果触发 UpdatePanel 的事件也是外部的,则 UpdateProgress 控件中的 AssociatedUpdatePanelID 属性将不起作用。
AssociatedUpdatePanelID property in the UpdateProgress control will not work if the event that triggered the UpdatePanel is also external.