我有一个来自 AjaxControlToolkit 的 ModalPopupExtender,它在 Firefox、Chrome 和 IE8 中正常工作,但是当我在 IE8 兼容模式下运行它时,它会弹出我页面内容的后面,而不是顶部。
弹出窗口位于由 Masterpage 呈现的用户控件中。我认为正在发生的是它在母版页内容前面弹出,因为母版页内容(我的标题和侧边栏)是灰色的,但内容占位符正在我的弹出窗口前面呈现。我在网上找到了一个解决方案,建议将母版页中的 doctype 声明更改为:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
但是我已经有了确切的声明,但仍然存在定位问题。这是弹出代码:
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="lnkbtnDealerID"
PopupControlID="pnlPopup"
BackgroundCssClass="modalBackground"
DropShadow="true"
OkControlID="OkButton"
CancelControlID="CancelButton"
OnOkScript=""
>
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none" Width="233px">
<p>Are you sure? Your current shopping cart is valid only for the current Dealer ID. Switching Dealer IDs will reset your cart according to the new Dealer ID chosen.</p>
<br />
<div align="center">
<asp:Button ID="OkButton" runat="server" Text="Ok" />
<asp:Button ID="CancelButton" runat="server" Text="Cancel" />
</div>
</asp:Panel>
以及相关的 CSS:
.popupControl {
background-color: white;
position:absolute;
visibility:hidden;
border-style:solid;
border-color: Black;
border-width: 2px;
}
.modalBackground {
background-color:Gray;
filter:alpha(opacity=70);
opacity:0.7;
}
.modalPopup {
background-color:white;
border-width:1px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}