1

我需要在模式对话框中打开一个 .aspx 页面。这是我用来打开对话框的 JS 代码:

        if (url) {
            var fullPath = url + "/Validation.aspx";
        }
        else {
            alert("Could not find the location of the merge dialog.  Please contact your System admin and have them update the configuration entity.");
            return;
        }

        var features = "unadorned:yes;scroll:yes;resizable:yes;status:yes;dialogHeight:480px;dialogWidth:480px;";

        var args = {
            selected: selectedIds,
            page: pageIds,
            fetchXml: xml,
            entity: "xyz"
        };

        window.showModalDialog(fullPath, args, features);

在我的validation.aspx 页面中,我需要能够获取JS 参数,将它们分配给隐藏字段,然后重新发布,这样我就可以在服务器端使用这些参数值。

这是我的 .aspx 页面中的 JS 代码:

window.onload = function(){        
    if (!window.dialogArguments)
        return;

        var args = window.dialogArguments;
        ...
}

我在整个网络上看到了大量这样的例子。 但是...我的 window.dialogArguments 在我的 .aspx 页面中始终未定义。是什么赋予了?有人有任何想法或解决方案吗?

4

1 回答 1

3

我在这里的假设是 ASPX 对话框页面是跨域打开的。

这意味着您的父页面位于一个域中,即:http://abc/page.html,而您的子对话页面位于另一个域中,例如:http://def/dialog.html

如果是这种情况,似乎对访问 dialogArguments 和 returnValue 有限制。例如,查看有关此先前答案的评论。

于 2012-10-23T22:09:19.023 回答