ASP.Net c# -一个页面上的多个UpdateProgress控件

本文关键字:控件 UpdateProgress Net ASP 一个 | 更新日期: 2023-09-27 18:14:18

我正在尝试实现UpdatePanels和UpdateProgress控件。我有两个UpdatePanels,包含两个不同的下拉列表(ddlQuestion5IDs和ddlQuestion6IDs)。

当我改变ddlQuestion6IDs的选定索引时,UpdateProgress为UpdatePanels/DropDownLists加载。这是他们通常的行为方式,是否有一种方法,只显示相应的UpdateProgress为每个UpdatePanel?

        <p>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Label ID="Label6" runat="server" Text="Question 5:" Font-Bold="true"></asp:Label>
                    <br />
                    <asp:DropDownList ID="ddlQuestion5IDs" runat="server" OnSelectedIndexChanged="ddlQuestion5IDs_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="true">
                        <ProgressTemplate>
                            <img src="images/loader.gif" height="20" />
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    <br />
                    <asp:Label ID="Label19" runat="server" Text="Question type:" Font-Italic="true"></asp:Label>
                    <br />
                    <asp:Label ID="lblQuestion5Type" runat="server" Text=""></asp:Label>
                    <br /><br />
                    <asp:Label ID="Label22" runat="server" Text="Question:" Font-Italic="true"></asp:Label>
                    <br />
                    <asp:Label ID="lblQuestion5" runat="server" Text=""></asp:Label>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="ddlQuestion5IDs" EventName="SelectedIndexChanged"/>
                </Triggers>
            </asp:UpdatePanel>
        </p>
        <p>
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Label ID="Label7" runat="server" Text="Question 6:" Font-Bold="true"></asp:Label>
                    <br />
                    <asp:DropDownList ID="ddlQuestion6IDs" runat="server" OnSelectedIndexChanged="ddlQuestion6IDs_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                    <asp:UpdateProgress ID="UpdateProgress2" runat="server" DynamicLayout="true">
                        <ProgressTemplate>
                            <img src="images/loader.gif" height="20" />
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    <br />
                    <asp:Label ID="Label21" runat="server" Text="Question type:" Font-Italic="true"></asp:Label>
                    <br />
                    <asp:Label ID="lblQuestion6Type" runat="server" Text=""></asp:Label>
                    <br /><br />
                    <asp:Label ID="Label24" runat="server" Text="Question:" Font-Italic="true"></asp:Label>
                    <br />
                    <asp:Label ID="lblQuestion6" runat="server" Text=""></asp:Label>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="ddlQuestion6IDs" EventName="SelectedIndexChanged"/>
                </Triggers>
            </asp:UpdatePanel>
        </p>

ASP.Net c# -一个页面上的多个UpdateProgress控件

通过向UpdateProgress添加AssociatedUpdatePanelID="UpdatePanelID"属性