Search code examples
c#cssmodalpopupextender

ModalPopupExtender blank x and y coordinates


I have a ModalPopupExtender like that:

<asp:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="ModalPopupBG"
                        runat="server" CancelControlID="btnCancel" OkControlID="btnOkay" TargetControlID="Bt_Open_Dialog"
                         PopupControlID="Panel1" Drag="true" PopupDragHandleControlID="PopupHeader"  
                         X="400" Y="400"
                         >
 </asp:ModalPopupExtender>

When the application runs and the ModalPopup is opened the html/css made for the Panel is:

<div class="popupConfirmation" style="position: fixed; z-index: 100001; left: 400px; top: 400px;" id="Panel1">

But what i actually want is the 'left' and 'top' attributes (the X and Y coordinates) not present!

<div class="popupConfirmation" style="position: fixed; z-index: 100001;" id="Panel1">

This is a problem because if X and Y are not set, some random value is always put by the compiler and it is not possible write blank coordinates.

Do you know something to do the trick?


Solution

  • I found a solution to my own question. It is not the cosiest way but it works in my situation.

    With the ModalPopupExtender i manage an iframe, so via javascript, in the onload event I get the panel and manually erase the attributes.

    var pnl = document.getElementById('Panel1');
    pnl.style.left = "";
    pnl.style.top = "";
    

    However in my page I had a boring side-effect: you could see the iframe loading in the first position (the x and y attributes are still present) and moving to the right position when the page ended loading (because the css is updated via js in that momement).

    So i had to write code to set the visibility as well.