window.showmodaldialog无法使用chrome [英] window.showmodaldialog not working in chrome

查看:195
本文介绍了window.showmodaldialog无法使用chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的项目使用VS2010 Express版。

I'm using VS2010 Express edition for my project.

我创建了一个注册表单,其中有提交按钮,这将打开新窗口(子窗口)。

I have created one registration form which is having "Submit" button, which will open up the new window (child window).

它包含aspx按钮()。

It contains aspx button ( ).

子窗口再次包含一个表单由我们填写并在点击保存按钮后表单被保存,如果我们关闭子窗口,则在保存之后会提交注册表单。

Child window again contains a form which is filled up by us and after clicking on Save button that form gets saved and after getting saved if we close the child window then the registration form gets submitted.

SetJavaScript();
        if (Session["IsSuccess"] != null)
            if (Session["IsSuccess"].ToString().ToLower() == "success")
                TextBox1.Text = Session["IsSuccess"].ToString();
        if (ddlTicketType.SelectedValue.ToString().ToLower() == "cr")
            btnSubmit.Attributes.Add("OnClick", "OpenChild(); ");
        if (ddlTicketType.SelectedValue.ToString().ToLower() == "pr")



< h2> btnSubmit.Attributes.Add(OnClick,clickno(););

由于window.showmodaldialog无法处理chrome。我也使用了window.open但它也没有正常工作,因为它打开子表单并在关闭它之后注册表单有错误消息请填写表单。
以下是在页面加载时调用的javascript代码。

btnSubmit.Attributes.Add("OnClick", "clickno();");

Since window.showmodaldialog is not working on chrome. I have used window.open also but its also not working properly as it open up the child form and after closing it registration form having error message "Please fill up the form". Below is the javascript code which is getting called on page load.

private void SetJavaScript()
   {
    string str_Script = "";
    str_Script += "<script type='text/javascript' language='javascript'>";
    str_Script += "function OpenChild() ";
    str_Script += "{ CheckValidation();";
    str_Script += "var varx = document.getElementById('TextBox1').value;";

    str_Script += "if (varx== 'yes'){";
    str_Script += "var ParmA = '2';";
    str_Script += "var MyArgs = new Array(ParmA);";
    str_Script += "if (ParmA=='2'){";
    str_Script += "var WinSettings = 'center:yes;resizable:yes;dialogheight:800px;dialogwidth:1000px';";
    str_Script += "MyArgs = window.showModalDialog('user/cr1.aspx', MyArgs, WinSettings);";

    str_Script += "if (MyArgs == null)";
    str_Script += "{";
    str_Script += "}";
    str_Script += "else";
    str_Script += "{";
    str_Script += "document.getElementById('TextBox1').value =MyArgs[0].toString();";
    str_Script += "}";
    str_Script += "}}";
    str_Script += "</script> ";
    this.Page.RegisterStartupScript("Reconnect", str_Script);



}



请帮帮我让它再次正常工作,因为它在chrome更新之前工作得非常好。
请告诉我任何可以解决此问题的好方法。

}

Please help me out to make it work again properly as it was working very fine earlier before chrome update. Please let me know any good alternative for this which will fix it.

推荐答案

正如你所读此处,不推荐使用Window.showModalDialog(),Chrome不支持从版本37开始已经完全从版本43中删除。

As you can read here, Window.showModalDialog() is deprecated and Chrome doesn't support it anymore from version 37 and has been completely removed from version 43.

使用 Bootstrap Modal 或者,如果太昂贵而无法更改,请尝试,这是一个window.showModalDialog polyfill

Use Bootstrap Modal instead or, if too expensive to change, try this library, that is a window.showModalDialog polyfill

这篇关于window.showmodaldialog无法使用chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆