如何在没有set_modal(true)的情况下打开RadWindow时禁用父页面

时间:2015-09-15 10:26:52

标签: javascript jquery asp.net telerik radwindow

如何在RadWindow打开时禁用父页面而不将set_modal属性的值设置为true?

var oWnd = radopen(finalURL, null, width, height);
oWnd.setUrl(finalURL);
oWnd.set_modal(true);     //// Without this line ?
oWnd.set_visibleStatusbar(false);
oWnd.show();
return oWnd;

1 个答案:

答案 0 :(得分:1)

由于IE错误,旧版本在iframe中会在IE下抛出错误。这在以后的版本中已修复,因此您应该升级。有关详细信息,请访问:http://www.telerik.com/support/kb/aspnet-ajax/window/details/opening-a-modal-radwindow-on-page-load-inside-radwindow-under-ie9-and-ie10

对此的修复主要是在对话框出现之前关注某些内容,例如:

function fix()
{
    document.documentElement.focus();
    Sys.Application.remove_load(fix);
}
Sys.Application.add_load(fix);

否则,您可以使用自己的div来模仿模态背景div。这是一个示例(即使它针对RadNotification控件:http://www.telerik.com/support/kb/aspnet-ajax/notification/details/how-to-make-a-modal-radnotification

这是本质:

    function showModalDiv(sender, args)
    {
        if (!modalDiv)
        {
            modalDiv = document.createElement("div");
            modalDiv.style.width = "100%";
            modalDiv.style.height = "100%";
            modalDiv.style.backgroundColor = "#aaaaaa";
            modalDiv.style.position = "absolute";
            modalDiv.style.left = "0px";
            modalDiv.style.top = "0px";
            modalDiv.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=50)";
            modalDiv.style.opacity = ".5";
            modalDiv.style.MozOpacity = ".5";
            modalDiv.setAttribute("unselectable", "on");
            modalDiv.style.zIndex = (sender.get_zIndex() - 1).toString();
            document.body.appendChild(modalDiv);
        }
        modalDiv.style.display = "";
    }

    function hideModalDiv()
    {
        modalDiv.style.display = "none";
    }

还有一些事件处理程序:

和一些CSS以确保在视口中贴合:

        html, body, form
        {
            margin: 0;
            padding: 0;
            height: 100%;
        }