简体   繁体   English

ModalPopupExtender空白x和y坐标

[英]ModalPopupExtender blank x and y coordinates

I have a ModalPopupExtender like that: 我有一个像这样的ModalPopupExtender:

<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: 当应用程序运行并打开ModalPopup时,为面板创建的html / css为:

<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! 但是我真正想要的是不存在“ left”和“ top”属性(X和Y坐标)!

<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. 这是一个问题,因为如果未设置X和Y,则编译器将始终放置一些随机值,并且无法写入空白坐标。

Do you know something to do the trick? 您知道要解决的办法吗?

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. 使用ModalPopupExtender可以管理iframe,因此通过javascript,在onload事件中,我会获得面板并手动擦除属性。

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). 但是在我的页面中,我有一个无聊的副作用:您可以看到iframe加载在第一个位置(x和y属性仍然存在),并在页面结束加载时移至正确的位置(因为css通过js)。

So i had to write code to set the visibility as well. 因此,我不得不编写代码来设置可见性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM