UpdateProgress链接到多个UpdatePanel控件

Die*_*r G 14 webforms asp.net-ajax

有没有办法让一个UpdateProgress控件与多个UpdatePanel控件相关联?这样的事情:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
     <ContentTemplate>
     .....
     </ContentTemplate>
</asp:UpdatePanel>

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
     <ContentTemplate>
     .....
     </ContentTemplate>
</asp:UpdatePanel>


<asp:UpdateProgress ID="UpdateProgress3" runat="server" AssociatedUpdatePanelID="UpdatePanel1, UpdatePanel2">.....
Run Code Online (Sandbox Code Playgroud)

小智 30

从标记中删除AssociatedUpdatePanelID,它将按您的意愿工作.

  • 谢谢你回复Scott,是的,这也是一个选项 - 这意味着我应该在所有Update Panel控件使用的页面上有一个更新进度控件,否则你的页面会像圣诞树一样点亮它们与特定的更新面板相关联 - 您的答案为+1. (3认同)

Ral*_*lle -1

我不这么认为。以编程方式尝试此操作,它坚持要求 UpdatePanel 有一个字符串 ID,并且没有指示您可以将 UpdatePanel 集合与特定 UpdateProgress 控件关联。

UpdateProgress1.AssociatedUpdatePanelID = "UpdatePanel1";
Run Code Online (Sandbox Code Playgroud)

从元数据:

Summary:
        //     Gets or sets the ID of the System.Web.UI.UpdatePanel control that the System.Web.UI.UpdateProgress
        //     control displays status for.
Run Code Online (Sandbox Code Playgroud)

所以,我看不出你能做到这一点。不过,好问题。

  • 您可以在一个页面上放置多个 UpdateProgress 控件,每个控件与不同的 UpdatePanel 控件关联。或者,您可以使用一个 UpdateProgress 控件并将其与页面上的所有 UpdatePanel 控件关联。http://msdn.microsoft.com/en-us/library/bb398821%28v=VS.90%29.aspx (3认同)
  • 如果将关联面板的 ID 留空,则页面上的所有 updatepanel 请求都会起作用。 (3认同)