我在一个aspx页面中有两个更新面板,每个内部都有一个ModalPopupExtender。我面临的问题是,我已在aspx页面中将Visible属性设置为false,并在需要显示时将其设置为True。但是,即使我设置了 Visible = True 属性,UpdatePanel也不会显示。
aspx代码:
<%--Request closed --%>
<asp:UpdatePanel ID="udpModalReqClose" runat="server" Visible="false">
<ContentTemplate>
<div style="display:none">
<asp:Button ID="btnDummyButton_ReqClose" UseSubmitBehavior="true" runat="server" Text="DummyButton" Style="display: none;" />
</div>
<asp:Panel ID="pnlCloseReq" runat="server" BackColor="White" BorderStyle="Solid" BorderColor="Black" BorderWidth="1px">
<div>
<table id="Table24" runat="server" border="0" cellpadding="4" cellspacing="10" width="400px">
<tr>
<td align="center">
<asp:Label ID="lblcloseSuccessOPR" runat="server" Font-Bold="true" ForeColor="Red" />
</td>
</tr>
<tr>
<td style="height: 5px;"></td>
</tr>
<tr>
<td align="center">
<asp:Button ID="btn_okclose" runat="server" SkinID="btnSearch" CssClass="btnSearch" OnClick="btnPOCPIRedirect_Click"
CausesValidation="false" align="center" Text="OK" Width="65px" />
</td>
</tr>
<tr>
<td style="height: 5px;"></td>
</tr>
</table>
</div>
</asp:Panel>
<cc1:ModalPopupExtender ID="mpeClosedSuccess" runat="server" PopupControlID="pnlCloseReq" TargetControlID="btnDummyButton_ReqClose"
BackgroundCssClass="modalPopup1" DropShadow="true" BehaviorID="mpe">
</cc1:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
<%--Request declined --%>
<asp:UpdatePanel ID="udpModalReqDecline" runat="server" Visible="false">
<ContentTemplate>
<div style="display:none">
<asp:Button ID="btnDummyButton_ReqDecline" UseSubmitBehavior="true" runat="server" Text="DummyButton" Style="display: none;" />
</div>
<asp:Panel ID="pnlRequestDecline" runat="server" BackColor="White" BorderStyle="Solid" BorderColor="Black" BorderWidth="1px">
<div>
<table id="Table17" runat="server" border="0" cellpadding="4" cellspacing="10" width="400px">
<tr>
<td align="center">
<asp:Label ID="lblRequestDecline" runat="server" Font-Bold="true" ForeColor="Red" />
</td>
</tr>
<tr>
<td style="height: 5px;"></td>
</tr>
<tr>
<td align="center">
<asp:Button ID="Button4" runat="server" SkinID="btnSearch" CssClass="btnSearch" OnClick="btnPOCPIRedirect_Click"
CausesValidation="false" align="center" Text="OK" Width="65px" />
</td>
</tr>
<tr>
<td style="height: 5px;"></td>
</tr>
</table>
</div>
</asp:Panel>
<cc1:ModalPopupExtender ID="mpeRequestDecline" runat="server" PopupControlID="pnlRequestDecline" TargetControlID="btnDummyButton_ReqDecline"
BackgroundCssClass="modalPopup1" DropShadow="true" BehaviorID="mpe">
</cc1:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
在aspx中触发模式弹出窗口的链接按钮:
<ItemTemplate>
<asp:LinkButton ID="LinkButton3" OnClick="lnkCloseReleaseHL" runat="server"
Text="Close"></asp:LinkButton>
</ItemTemplate>
<asp:TemplateColumn HeaderText="Decline">
<ItemTemplate>
<asp:LinkButton ID="lnkDeclineHLRelease" runat="server" OnClick="lnkDeclineHLRelease_Click">Decline All</asp:LinkButton>
</ItemTemplate>
后面的代码:
public void lnkCloseReleaseHL(object sender, System.EventArgs e)
{
udpModalReqClose.Visible = true;
string successMsg = "Request has been closed Succesfully.";
lblcloseSuccessOPR.Text = successMsg;
mpeClosedSuccess.Show();
}
protected void lnkDeclineHLRelease_Click(object sender, EventArgs e)
{
udpModalReqDecline.Visible = true;
string successMsg = "Request has been declined.";
lblRequestDecline.Text = successMsg;
mpeRequestDecline.Show();
}
如果我没有在aspx页面中设置Visible = False属性,则该ModalPopup之一将显示在网页上,并在弹出菜单中插入“确定”按钮,将其留空。
此外,如果我的aspx页面中只有一个UpdatePanel,则弹出窗口可以很好地工作而无需设置Visible属性。一旦在其下添加另一个UpdatePanel,就会出现此问题(链接中的屏幕截图),在页面加载时,带有“确定”按钮的面板会显示在该面板上。 Panel appearing on page with the 'OK' button
我尝试在网络上搜索所有可能的解决方案,但没有任何帮助。如果有人可以指导我如何解决此问题,那将有很大帮助。我只想知道如何在不出现此问题的情况下使多个UpdatePanels正常工作。
答案 0 :(得分:0)
我不确定,但是您可以尝试使用 style =“ display:none” 代替 Visible =“ false”