AJAX ModalPopup 在页面内容后面(下方)弹出(负 z-index)

发布于 2024-09-01 12:32:16 字数 862 浏览 9 评论 0原文

我在 AJAX Control Toolkit (http:// ajaxcontroltoolkit.codeplex.com/releases/view/43475)。

ModalPopup 第一次可见时它可以正常工作。 z-index 设置为 6001(背景 Div 的 z-index 设置为 6000),并且 Popup 出现在其他所有内容之上。如果单击 ModalPopup 中的取消按钮,它也具有正确的功能,显示设置为“无”并且 ModalPopup 不再可见。

但是,当再次触发 Popup 时,z-index 仅设置为 2000,这仍然高于其他所有内容,但如果取消并再次触发,则设置为 -2000,这是不可见的(z-index 是每次减少4000)。

我不知道为什么会发生这种情况。有什么想法如何修复它吗?

特殊情况:

  • 页面上有多个ModalPopup。
  • 所有 ModalPopups 都通过部分页面回发(使用 .Show() 方法)在代码隐藏中触发(使用 .Show() 方法)
  • ModalPopupExtender 位于显示为弹出窗口 UPDATE 的相同 UpdatePanel 内

: 这是项目团队确认的错误。 http://ajaxcontroltoolkit.codeplex.com/workitem/26739。现在已经修复了。

I am having an issue with the AJAX ModalPopupExtender in version 40412 of the AJAX Control Toolkit (http://ajaxcontroltoolkit.codeplex.com/releases/view/43475).

The first time the ModalPopup is made visible it works correctly. The z-index is set to 6001 (and the background Div's z-index is set to 6000) and the Popup appears above everything else. If the cancel button within the ModalPopup is clicked, it also has the correct functionality, the display is set to "none" and the ModalPopup is no longer visible.

However, when the Popup is triggered again, the z-index is only set to 2000 which is still visible above everything else, but if it is canceled and triggered again it is set to -2000 which is not visible (the z-index is decreasing by 4000 each time).

I'm not sure why this is happening. Any ideas how to fix it?

Special circumstances:

  • There are multiple ModalPopup's on the page.
  • All ModalPopups are triggered in code-behind through partial-page postbacks (using the .Show() method)
  • ModalPopupExtenders are within the same UpdatePanels that are displayed as popups

UPDATE:
this was a confirmed bug by the project team. http://ajaxcontroltoolkit.codeplex.com/workitem/26739. It has now been fixed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

苏佲洛 2024-09-08 12:32:16

一种解决方法是按如下所示设置 ModalPopup 的 CSS;这将覆盖 AJAX 控制工具包应用于元素的内联 CSS。

.ModalPopup
{
    z-index: 6001 !important;
}
.ModalPopupBackground
{
    z-index: 6000 !important;
}

One workaround is to set the CSS for the ModalPopup as follows; This will override the in-line CSS applied to the element by the AJAX Control Toolkit.

.ModalPopup
{
    z-index: 6001 !important;
}
.ModalPopupBackground
{
    z-index: 6000 !important;
}
暮倦 2024-09-08 12:32:16

我刚刚遇到了这样的问题。这是我想出的一个快速修复方法,

<script type="text/javascript">
    onload = function() {
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(resetCounter);
    }
    function resetCounter(sender, args) {
        try {
            Sys.Extended.UI.ModalPopupBehavior._openCount = 0;
        } catch (ex) {
            // try-catch-throw away!
        }
    }
</script>

在 ExtendedModalPopup javascript 中,它在每个部分页面回发上调用 hide,这会执行 _openCount-- 操作。

这是基于 _opencount 设置 zindex 的代码:

var zindex = 10000 + (Sys.Extended.UI.ModalPopupBehavior._openCount++ * 1000);

因此 _openCount 设置为负数

I just had a problem like this. Here is a quick fix that I came up with

<script type="text/javascript">
    onload = function() {
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(resetCounter);
    }
    function resetCounter(sender, args) {
        try {
            Sys.Extended.UI.ModalPopupBehavior._openCount = 0;
        } catch (ex) {
            // try-catch-throw away!
        }
    }
</script>

In the ExtendedModalPopup javascript it is calling hide on each partial page post back which does a _openCount--.

This is the code where the zindex is getting set based on the _opencount:

var zindex = 10000 + (Sys.Extended.UI.ModalPopupBehavior._openCount++ * 1000);

So _openCount is getting set to a negative number

べ映画 2024-09-08 12:32:16

这是项目团队确认的错误。 http://ajaxcontroltoolkit.codeplex.com/workitem/26739。现在已经修复了。

来自团队:我们已经确认这是初始版本 40412 中存在的错误。我们现在已替换为修复此问题的修改版本。请重新下载40412解决此问题

This was a confirmed bug by the project team. http://ajaxcontroltoolkit.codeplex.com/workitem/26739. It has now been fixed.

From Team: We have confirmed that this is a bug that was in the initial release 40412. We have now replaced with a modified release that fixes this. Please download 40412 again to resolve this issue

蹲墙角沉默 2024-09-08 12:32:16

就我而言,模态弹出窗口前 10 次工作正常,但下一次出现在页面其他组件的后面。在 css 中设置 z-index 对我有用,谢谢!

.modalbackground {
    background-color: Gray;        
    filter: alpha(opacity=70);
    opacity: 0.7;
    z-index: 6000 !important;
    }    
.popup
    {        
    background-color:#FFF;
    padding:10px;     
    max-width:600px;
    z-index: 6001 !important;
    }

In my case, the modalpopup works perfectly the first 10 times but the next time appears behind other components of the page. Setting z-index in css works for me, thank you!

.modalbackground {
    background-color: Gray;        
    filter: alpha(opacity=70);
    opacity: 0.7;
    z-index: 6000 !important;
    }    
.popup
    {        
    background-color:#FFF;
    padding:10px;     
    max-width:600px;
    z-index: 6001 !important;
    }
窗影残 2024-09-08 12:32:16

如果涉及更新面板,工具包的 15.1.4 版本中也会出现类似的问题。
https://ajaxcontroltoolkit.codeplex.com/workitem/27971
目前尚未修复,但 15.1.3 并未显示此问题。

A similar problem was introduced in version 15.1.4 of the toolkit if an Update Panel is involved.
https://ajaxcontroltoolkit.codeplex.com/workitem/27971
At this Time it has not been fixed, but 15.1.3 does not show this problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文