新手,对这个问题有点疑惑,我在A.aspx页面(父窗体)放一个按钮,点击它到B.aspx(子窗体)
A.aspx.cs的代码如下:        string a = TextBox1.Text.ToString();
        Response.Write("<script language='javascript'>window.showModalDialog('B.aspx?id="+a+"','', 'dialogWidth:1000px;dialogHeight:700px;status=no;resizable=yes;help=no');</script>");B页面中放一个TextBox和一个Button,TextBox接收前面父窗体传来的值,按钮是用来修改父窗体传来的值,并将当前的这个值显示在父窗体中。B.aspx.cs的代码如下
   protected void Page_Load(object sender, EventArgs e)
    {
           TextBox1.Text=Request.QueryString["id"].ToString();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Write("<script>window.opener.document.getElementById('<%=TextBox1.ClientID %>').value="+TextBox1.Text+"</script>");
      //  Response.Write("<script>window.returnValue='OK';window.close()</script>");
    }
请问怎么解决呢,谢了

解决方案 »

  1.   

    B页面的// Response.Write("<script>window.returnValue='OK';window.close()</script>");
    这应该是要到父页面接受
    var retrunValue=window.showModalDialog('B.aspx?id="+a+"','', 'dialogWidth:1000px;dialogHeight:700px;status=no;resizable=yes;help=no');
      

  2.   

    你打开的窗体要获得父窗体的值
    你直接超链接传过去
    B.aspx?Id=XXX
    子窗体接受参数就可以了
    request.querystring["Id"]
      

  3.   

    也可以用Cookie
    Session在showModalDialog下会丢失!!!