0

first panel在另一个面板中有一个 Ajax 面板second panelupdateProgress链接到第一个面板

有了这个我有两个问题:

  • updateProgress 在第二个面板更新时显示进度图像,但在第一个面板更新时不显示
  • 要更新第二个面板,我必须按第二个面板内的按钮两次

    <asp:UpdateProgress ID="UProc_TabContainer" runat="server" AssociatedUpdatePanelID="UP_FirstPanel"
    DisplayAfter="1">
    <ProgressTemplate>
        <div id="dvProgress" runat="server" style="position: absolute; top: 300px; left: 450px;
            text-align: center;">
            <asp:Image ID="wait" runat="server" ImageUrl="~/Images/wait3.gif" Height="120px"
                Width="128px" />
        </div>
    </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="UP_FirstPanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <script language="javascript" type="text/javascript">
            function divexpandcollapse(divname) {
                var div = document.getElementById(divname);
                var img = document.getElementById('img' + divname);
                if (div.style.display == "none") {
                    div.style.display = "block"; img.src = "Images/Icons/minus.jpg";
                } else { div.style.display = "none"; img.src = "Images/Icons/plus.jpg"; }
            }</script>
        <asp:DropDownList ID="DateSelection" runat="server" AutoPostBack="True" Height="21px"
            Width="134px">
        </asp:DropDownList>
        <asp:GridView ID="GV_SL" runat="server" OnRowDataBound="gvUserInfo_RowDataBound"
            OnRowCommand="GV_SL_RowCommand" AutoGenerateColumns="false" DataSourceID="SQL_Weekly">
            <Columns>
                <asp:TemplateField ItemStyle-Width="50px">
                    <ItemTemplate>
                        <a href="JavaScript:divexpandcollapse('div<%# Eval("name") %>');">
                            <img id="imgdiv<%# Eval("name") %>" width="15px" border="0" src="Images/Icons/plus.jpg" /></a></ItemTemplate>
                    <ItemStyle Width="40px" />
                </asp:TemplateField>
                <asp:BoundField DataField="name" HeaderText="Group" SortExpression="name" />
                <asp:BoundField DataField="ASL" HeaderText="SL% Act" ReadOnly="True" SortExpression="ASL" />
                <asp:TemplateField>
                    <ItemTemplate>
                        <tr>
                            <td colspan="100%">
                                <div id="div<%# Eval("name") %>" style="display: none; position: relative; left: 15px;
                                    overflow: auto">
                                    <asp:GridView ID="gvChildGrid" runat="server" AutoGenerateColumns="false">
                                        <Columns>
                                            <asp:BoundField DataField="Metric" HeaderText=" " HeaderStyle-HorizontalAlign="Left" />
                                            <asp:BoundField DataField="Actual" HeaderText="Actual" HeaderStyle-HorizontalAlign="Left" />
                                        </Columns>
                                    </asp:GridView>
                                    <br />
                                    <asp:UpdatePanel ID="UP_SecondPanel" runat="server" UpdateMode="Always">
                                        <ContentTemplate>
                                            <%--  --%>
                                            <asp:TextBox ID="TB_Comments" runat="server" Text="Example: Text will be entered here"
                                                TextMode="MultiLine" Rows="4" Width="510px"></asp:TextBox>
                                            <asp:Button ID="B_Save" runat="server" CommandName="AddText" CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
                                                Text="Save Changes" />
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                    <%--  --%>
                                </div>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="DateSelection" EventName="SelectedIndexChanged" />
    </Triggers>
    

关于我做错了什么的任何想法?

谢谢

4

1 回答 1

1

我通过从 UpdateProgress 中删除 AssociatedUpdatePanelID="UP_FirstPanel" 解决了第一个问题。我希望它可以帮助某人

我为第二个问题创建了一个单独的帖子,其中包含更多详细信息和简化代码(Gridview 中的嵌套 Ajax UpdatePanel 需要单击两次按钮控件

于 2013-09-27T09:29:24.630 回答