0

我有两个更新面板,在这些更新面板中是两个模态弹出窗口。我正在尝试从 modalpopup 内的第一个更新面板内的控件(按钮)更改其中一个更新面板内的标签。单击按钮后,第一个 modalpopup 将关闭,第二个 modalpopup 将显示标签更改,但弹出窗口内的标签不显示。

当我尝试在后面的代码中调用 secondUpdatePanel.Update() 时,第二个模式弹出窗口甚至没有出现。帮助表示赞赏!我已经看过将 asyncpostbacktriggers 从第一个弹出窗口分配到第二个弹出窗口的教程,这些教程不在模态弹出窗口中。

所以,我可能会遗漏一些东西。

<asp:UpdatePanel ID="upPnlFormalAppeal" runat="server" UpdateMode="Conditional" >
        <ContentTemplate>
            <asp:HiddenField ID="hfFormalAppeal" runat="server" />
            <asp:ModalPopupExtender ID="mpopupFormalAppeal" runat="server"
                TargetControlID="hfFormalAppeal" 
                PopupControlID="pnlFormalAppealPopup" 
                CancelControlID="btnClose" 
                BackgroundCssClass="modalBackground" >
                <Animations>
                    <OnShown><Fadein Duration="0.50" /></OnShown>
                    <OnHiding><Fadeout Duration="0.75" /></OnHiding>
                </Animations>
            </asp:ModalPopupExtender>
            <!-- Details View for Formal Appeal -->
            <asp:DetailsView ID="dvFormalAppeal" runat="server" Height="50px" AutoGenerateRows="False" CssClass="dvCSS" >
                <!-- DATA HERE -->
            </asp:DetailsView>
            <div class="footer">
                <asp:LinkButton ID="btnSubmit" runat="server" Text="Submit" 
                    CausesValidation="false" OnClick="btnSubmit_Click" />
                    &nbsp;
                <asp:LinkButton ID="btnClose" runat="server" Text="Close" CausesValidation="false" />
                <asp:ConfirmButtonExtender ID="cbeSubmit" runat="server" 
                    ConfirmText="Submit Appointment Request?" TargetControlID="btnSubmit">
                </asp:ConfirmButtonExtender>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>

modalpopup 中的第二个 UpdatePanel。

<asp:Panel ID="Panel1" runat="server" CssClass="panelConfirmation" >
    <asp:UpdatePanel ID="upPnlMessageBox" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <ContentTemplate>
            <asp:HiddenField ID="hfSubmissionConfirmationBox" runat="server" />
            <asp:ModalPopupExtender ID="mpopupConfirmation" runat="server"
                TargetControlID="hfSubmissionConfirmationBox" 
                PopupControlID="Panel1" 
                CancelControlID="btnClose" 
                BackgroundCssClass="modalBackground" >
            </asp:ModalPopupExtender>
                    <div class="mpopupBody">
                        <asp:Label ID="lblConfirmationMessage" runat="server"></asp:Label>
                    </div>
                    <div class="footer">
                        <asp:Button ID="btnConfirmClose" runat="server" Text="Close" 
                            CausesValidation="false" onclick="btnConfirmClose_Click" />
                    </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnConfirmClose" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Panel>

后面的代码。

protected void btnSubmit_Click(object sender, EventArgs e)
    {
        this.mpopupFormalAppeal.Hide();

        this.lblConfirmationMessage.Text = "Text changed!";
        //this.upPnlMessageBox.Update();
        this.mpopupConfirmation.Show();
    }

任何帮助表示赞赏!

4

1 回答 1

0

对于那些有相同场景的人......我设法通过重新排序我的布局设计来解决它。

我将 modalpopup 放在 UpdatePanel 之外,如下所示:

<asp:HiddenField ID="hfSubmissionConfirmationBox" runat="server" />
<asp:ModalPopupExtender ID="mpopupConfirmation" runat="server"
    TargetControlID="hfSubmissionConfirmationBox" 
    PopupControlID="Panel1" 
    CancelControlID="btnClose" 
    BackgroundCssClass="modalBackground" >
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="panelConfirmation" >
    <asp:UpdatePanel ID="upPnlMessageBox" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <ContentTemplate>
            <div class="mpopupBody">
                <asp:Label ID="lblConfirmationMessage" runat="server"></asp:Label>
            </div>
            <div class="footer">
                <asp:Button ID="btnConfirmClose" runat="server" Text="Close" 
                    CausesValidation="false" onclick="btnConfirmClose_Click" />
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnConfirmClose" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Panel>
于 2012-11-24T20:59:56.563 回答