【问题标题】:ModalPopupExtender blank x and y coordinatesModalPopupExtender 空白 x 和 y 坐标
【发布时间】:2015-12-15 10:57:31
【问题描述】:

我有一个这样的 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>

当应用程序运行并打开 ModalPopup 时,为面板制作的 html/css 为:

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

但我真正想要的是“左”和“上”属性(X 和 Y 坐标)不存在!

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

这是一个问题,因为如果没有设置 X 和 Y,编译器总是会放入一些随机值,并且不可能写入空白坐标。

你知道怎么做吗?

【问题讨论】:

    标签: c# css modalpopupextender


    【解决方案1】:

    我找到了解决我自己问题的方法。 这不是最舒适的方式,但它适用于我的情况。

    使用 ModalPopupExtender 我管理一个 iframe,因此通过 javascript,在 onload 事件中我获取面板并手动擦除属性。

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

    但是在我的页面中我有一个无聊的副作用:您可以看到 iframe 在第一个位置加载(x 和 y 属性仍然存在)并在页面结束加载时移动到正确的位置(因为 css在那一刻通过js更新)。

    所以我也必须编写代码来设置可见性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 2012-09-17
      • 1970-01-01
      • 1970-01-01
      • 2013-05-05
      • 2022-01-16
      • 1970-01-01
      相关资源
      最近更新 更多