同一个aspx页面上有两个嵌套的更新面板

时间:2017-06-07 17:27:15

标签: c# asp.net gridview updatepanel updateprogress

我在apsx页面上有两个嵌套的UpdatePanel控件。外部页面用于整个页面并显示"正在加载页面..." img,而内部的目的是在dropdownlist selectedIndexChanged

上加载网格

我得到此错误,但两者都有不同的名称: JavaScript运行时错误:Sys.InvalidOperationException:具有相同id的两个组件&c; 39.cphMainContent_Updprog3'无法添加到应用程序中。

请指导。这是代码结构:

     <asp:content id="HeaderContent" runat="server" contentplaceholderid="head">

    <script language="javascript" type="text/javascript">
            function showProgress() {
                var updateProgress = $get("<%=Updprog3.ClientID %>");
                updateProgress.style.display = "block";
            }

        </script>
    </asp:content>

    <asp:content id="BodyContent" runat="server" contentplaceholderid="cphMainContent">
        <div style="padding-left:36px; padding-top:10px;">
            <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
                <ContentTemplate>
    <table align="left">

           <tr>
                <td style="border: none; width:120px">
                    Call Category Group:
                </td>
                <td>
                    <asp:DropDownList ID="ddlGroup" runat="server" 
                        onChange="javascript:showProgress()"
                        OnSelectedIndexChanged="ddlGroup_SelectedIndexChanged" Width="400px">
                        <asp:ListItem Value="-1">--- Select Group ---</asp:ListItem>
                        <asp:ListItem Value="Group 1"> Group 1</asp:ListItem>
                        <asp:ListItem Value="Group 2">Group 2</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>

      <!--2nd update panel-->
    <asp:UpdatePanel ID="UpdPnl" runat="server" UpdateMode="Conditional">
       <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlCallCategoryGroup" EventName="SelectedIndexChanged"/>
        </Triggers>
    <ContentTemplate>

    <asp:GridView ID="gridView1" runat="server">
    </asp:GridView>
    </ContentTemplate>
    </asp:UpdatePanel>

    <asp:Panel runat="server" ID="pnlgvSecondLevelLoading" CssClass="modalwindow">
    <asp:UpdateProgress ID="Updprog3" runat="server" AssociatedUpdatePanelID="UpdPnl">
        <ProgressTemplate>
                        <table>
                        <tr>
                            <td align="right" width="35%">
                                <asp:Image ID="imgSubCallCategory_Wait3" runat="server" ImageUrl="ProjectImages/Wait_Small.gif" />
                            </td>
                            <td width="2%">
                            </td>
                            <td align="center" width="73%">
                                Loading data . . .
                            </td>
                        </tr>
                    </table>

        </ProgressTemplate>
    </asp:UpdateProgress>
    </asp:Panel>

    <asp:Panel runat="server" ID="pnlLoading" CssClass="modalwindow">
        <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
            <ProgressTemplate>
                <div class="container2">
                    <div class="content">
                        <br />
                        <table>
                            <tr>
                                <td align="right" width="35%">
                                    <asp:Image ID="imgSubCallCategory_Wait2" runat="server" ImageUrl="ProjectImages/30-1.gif" />
                                </td>
                                <td width="2%">
                                </td>
                                <td align="center" width="73%">
                                    Loading Page . . .
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </asp:Panel>
         </ContentTemplate>
        </asp:UpdatePanel> 
    </div>
</asp:content>

1 个答案:

答案 0 :(得分:0)

<asp:ScriptManager ID="WebApp" runat="server" AsyncPostBackTimeout="36000" ScriptMode="Release"></asp:ScriptManager>