在ASP.NET中使用回发​​的jQuery模式对话框

时间:2022-11-01 11:08:57

I just upgraded my jQuery/jQuery UI to the latest version (jQuery 1.9.0, jQuery UI 1.10.0), and it seems to have broken some of my jQuery UI dialog functionality.

我刚刚将我的jQuery / jQuery UI升级到最新版本(jQuery 1.9.0,jQuery UI 1.10.0),它似乎打破了我的一些jQuery UI对话框功能。

In order to do postbacks in a jQuery UI dialog in ASP.NET, there was a pretty common workaround where you would have to re-append your DIV to the main FORM, since jQuery would re-construct the DIV outside the FORM, like so:

为了在ASP.NET中的jQuery UI对话框中进行回发,有一个非常常见的解决方法,你必须将你的DIV重新附加到主FORM,因为jQuery会重新构造FORM之外的DIV,就像这样:

$("#newInsurance").dialog({
    autoOpen: false,
    modal: true,
    open: function (type, data) {
        $(this).parent().appendTo($("form:first"));
    }
});

Unfortunately, since upgrading this now puts the Dialog behind the gray/disabled overlay for the background. So the form in the Popup is unusable and all grayed out. I've tried several things and I can't seem to get it to work - it seems as if this old work-around no longer works. Does anyone know of a new work-around that will work? Or am I missing something? This worked great up until I upgraded.

不幸的是,由于升级现在将Dialog置于灰色/禁用覆盖背后。因此Popup中的表单无法使用并且全部变灰。我已经尝试了几件事情,但我似乎无法让它发挥作用 - 似乎这种旧的解决方法不再适用。有谁知道一个新的解决方案将有效吗?或者我错过了什么?这很好用,直到我升级。

Here is some more information about the work-around that USED to work:

以下是有关USED工作的更多信息:

I tested this with Internet Explorer 9 and Google Chrome 24.x

我使用Internet Explorer 9和Google Chrome 24.x对此进行了测试

According to the jQuery UI website, the Dialog API has been completely redesigned in jQuery UI 1.10.0:

根据jQuery UI网站,在jQuery UI 1.10.0中完全重新设计了Dialog API:

1 个解决方案

#1


18  

OK, so this seems to be the fix for jQuery UI v1.10:

好的,所以这似乎是jQuery UI v1.10的修复:

$("#newInsurance").dialog({
    autoOpen: false,
    appendTo: "form",
    modal: true
}).parent().css('z-index', '1005');

In jQuery UI v1.10 they added an appendTo property, which seems to do the same exact thing as calling .parent().appendTo($("form")). The trick to the fix is the z-index.

在jQuery UI v1.10中,他们添加了一个appendTo属性,它似乎与调用.parent()。appendTo($(“form”))完全相同。修复的技巧是z-index。

#1


18  

OK, so this seems to be the fix for jQuery UI v1.10:

好的,所以这似乎是jQuery UI v1.10的修复:

$("#newInsurance").dialog({
    autoOpen: false,
    appendTo: "form",
    modal: true
}).parent().css('z-index', '1005');

In jQuery UI v1.10 they added an appendTo property, which seems to do the same exact thing as calling .parent().appendTo($("form")). The trick to the fix is the z-index.

在jQuery UI v1.10中,他们添加了一个appendTo属性,它似乎与调用.parent()。appendTo($(“form”))完全相同。修复的技巧是z-index。