ModalPopupExtender won't render in front of everything in IE7/IE8 Compatibility mode

15,303

Solution 1

I just found your posting whilst trying so solve the same problem. For me I tracked it down to a div tag, called mainBody, which all page content is contained within. The CSS class that controls this div has relative positioning but no z-index. As soon as I set the z-index to -1 for mainBody my modalPopup worked perfectly in IE7.

Hope this helps?!

Solution 2

You can only set the Z-index in IE for the parent div you are in. A div higher up will always render on top of your lower div. I solved the problem by Always put the Modualwindow Div directly after the tag. If it's the first div it's always on top.

Henrik

Solution 3

I'd like to add that Z-index is indeed the issue for those running into this in IE 10 compat view, which defaults to IE7 doc mode on a local network.

I used z-index: -1 for the html and body, and then had to go to a z-index: 100 for the other containers. The pop-up classes are at a z-index: 999999; You'll need to adjust for your site.

Share:
15,303
fr0man
Author by

fr0man

Updated on February 07, 2023

Comments

  • fr0man
    fr0man about 1 year

    I have a ModalPopupExtender from the AjaxControlToolkit that is working properly in Firefox, Chrome and IE8, but when I run it in IE8 Compatibility mode, it pops up behind the content of my page, rather than on top.
    The popup is in a user control that's rendered by the Masterpage. What I think is happening is it's popping up in front of the master page content, as the Masterpage content (my header and sidebars) is greyed out, but the content placeholders are rendering in front of my popup. I found a solution online that suggested changing your doctype declaration in the master page to:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    

    But I already had that exact declaration and still have the positioning problem. Here is the popup code:

    <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>
    

    And the relevant 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;
    }
    
  • fr0man
    fr0man over 14 years
    This was promising, but didn't work. I put a z-index on and around everything I could and it's still not popping in front of my placeholder content.