我在asp.net web窗體項目的母版頁上使用PoupControl作爲基礎彈出窗口。我的問題是;在彈出一次後,彈出窗口會出現在每個頁面上。當點擊彈出窗口上的關閉或確定按鈕時,彈出窗口被隱藏。它不應該出現在每個頁面渲染之後。我嘗試使用ShowOnPageLoad =「false」,但它不能工作。ASPxPopupControl出現在每個頁面加載
Master .aspx頁面是這樣的;
<dx:ASPxPopupControl ID="BasePopupControl" runat="server" Modal="true" HeaderText="" CloseAction="CloseButton" Theme="Moderno"
PopupHorizontalAlign="WindowCenter" AllowDragging="True" HeaderImage-IconID="actions_cancel_32x32" PopupVerticalAlign="WindowCenter"
Width="350" Height="150" ClientInstanceName="BasePopupControl" ShowOnPageLoad="false">
<ContentCollection>
<dx:PopupControlContentControl ID="PopupControlContentControl2" runat="server" HeaderStyle-HorizontalAlign="Left" HorizontalAlign="Center">
<table width="100%">
<tr align="center">
<td>
<dx:ASPxLabel runat="server" ID="lblMessage" ClientInstanceName="lblMessage" Theme="Moderno"></dx:ASPxLabel>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr align="center">
<td>
<dx:ASPxButton ID="btnPopupOK" runat="server" Text="Tamam" Theme="Moderno">
<ClientSideEvents Click="function(s, e) { BasePopupControl.Hide(); e.processOnServer = false; }" />
</dx:ASPxButton>
</td>
</tr>
</table>
</dx:PopupControlContentControl>
</ContentCollection>
</dx:ASPxPopupControl>
<dx:ASPxGlobalEvents runat="server" ID="GlobalEvent" EnableViewState="false"></dx:ASPxGlobalEvents>
這些代碼顯示彈出;
ASPxGlobalEvents popupEvent = null;
ASPxPopupControl popupControl = null;
if (this.Master != null)
{
popupEvent = (ASPxGlobalEvents)this.Master.FindControl("GlobalEvent");
popupControl = (ASPxPopupControl)this.Master.FindControl("BasePopupControl");
}
else
{
popupEvent = (ASPxGlobalEvents)this.Page.FindControl("GlobalEvent");
popupControl = (ASPxPopupControl)this.Page.FindControl("BasePopupControl");
}
if (popupEvent != null)
{
popupEvent.ClientSideEvents.ControlsInitialized = "function(s,e){lblMessage.SetText('" + Message + "'); BasePopupControl.Show();}";
switch (Type)
{
case BasePopupType.Error:
popupControl.HeaderImage.IconID = IconID.ActionsCancel32x32;
break;
case BasePopupType.Success:
popupControl.HeaderImage.IconID = IconID.ActionsApply32x32;
break;
default:
case BasePopupType.Info:
popupControl.HeaderImage.IconID = IconID.SupportInfo32x32;
break;
}