父页通过showmodaldialog打开子页,子页上有个按钮,这个按钮是服务器控件。
怎样做到在点击这个按钮的时候关闭子页并刷新父页呢?

解决方案 »

  1.   

    <input type="button" value="关闭" onclick="window.close();window.opener.location.href=window.opener.location.href;" />
      

  2.   

    如果放到CS内的话:        Button_Click(..)
            {
            Response.Write("<script>window.opener.location.href=window.opener.location.href;window.close();</script>");
            Response.End();
            }
      

  3.   

    我的子页上的button是服务器控件
      

  4.   


     string strScr = "<script language=javascript> parent.document.location.href = parent.document.location.href;window.close(); </script>";
                //Page.RegisterClientScriptBlock("Close", strScr);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", strScr);
      

  5.   

    你是怎么打开showmodaldialog的,给你个代码参考下 function showmoney(obj) {
                var returnValue = window.showModalDialog('money_list.aspx?pid=' + obj, '', 'dialogWidth:910px;dialogHeight:500px;resizable:no;scroll:auto;status:no;');
                location.reload();
            }这个实现打开窗口,添加或者修改数据等,关闭后父页面会刷新
      

  6.   

    在你的子页面的<head>下打入
    <base target="_self" />
      

  7.   

    window.open()估计行.<input type="button" value="button" onclick="javascrplt:if(window.opener)window.opener.close();"/>
      

  8.   

    这个回答是错误的,showModalDialog是没有opener的