我在 asp.net web 表单项目的母版页上使用 PoupControl 作为 Base Popups。我的问题是;在显示弹出窗口一次后,弹出窗口出现在每个页面渲染中。当单击弹出窗口上的关闭或确定按钮时,弹出窗口是隐藏的。它不应该出现在每个页面呈现之后。我尝试使用 ShowOnPageLoad="false" 但它不起作用。
像这样掌握 .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;
}