您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> .NET >> windowshowModalDialog刷新父窗口问题

windowshowModalDialog刷新父窗口问题

来源:网络整理     时间:2016/7/7 6:23:01     关键词:

关于网友提出的“ windowshowModalDialog刷新父窗口问题”问题疑问,本网通过在网上对“ windowshowModalDialog刷新父窗口问题”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: windowshowModalDialog刷新父窗口问题
描述:

父页面代码


//写在pageload里
  int i = 1;
            if (i == 1)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "open", " var str = document.getElementById(\"hid\"); alert(str.value=window.showModalDialog(\"b.aspx?UserName=123\"));");
            }
            if (hid.Value == "1")
            {
                Response.Write("b.aspx");
            }

模态框弹出的页面代码(子窗口):

 protected void Page_Load(object sender, EventArgs e)
        {
            string userName = Request.QueryString["UserName"].ToString();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "open", "window.returnValue = 1;window.close(); ");
        }

现在想知道如何让我点击完子窗口的按钮之后再触发父页面的这段代码:
        if (hid.Value == "1")
            {
                Response.Write("b.aspx");
            }
有没有看明白我的需求?
解决方案1:

if (hid.Value == "1")
  {
  Response.Write("b.aspx");
  }
你要在服务器执行?js是客户端的,要在服务器执行,你需要先把结果提交

解决方案2:

关闭 子窗体时,加上parent.hid.value=1;parent.window.loction.reload();
就是 设置父窗体的 hid 控件值,刷新父窗体
 ClientScript.RegisterStartupScript(this.GetType(), "open", "window.returnValue = 1;window.close(); ");


以上介绍了“ windowshowModalDialog刷新父窗口问题”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2369329.html

相关图片

相关文章