我在页面上有两个更新面板和一个进度条。如果我设置了 AssociatedUpdatePanelID,那么进度条不起作用,没有设置 AssociatedUpdatePanelID 进度条正在工作,但问题对两个更新面板都有效。但我需要在一个更新面板上工作。
<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>
代码背后 - 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