关掉子窗口,刷新父窗口
一、调用
二、返回
if (!IsClientScriptBlockRegistered("ClientScript"))
{
this.HiddenField1.Value = "0";
string strScript = "<script>" + "\r\n";
strScript += "function OpenWin(){" + "\r\n";
strScript += "var str=window.open('TaskComment.aspx?TaskID=" + Request.QueryString["TaskID"].ToString().Trim() + "',document.form1.HiddenField1.value,'top=200,left=240,height=220,width=420,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no')" + "\r\n";
strScript += "if(str!=null) document.form1.HiddenField1.value=str" + "\r\n";
strScript += "if(str!=null) document.form1.submit()" + "\r\n";
strScript += "}" + "\r\n";
strScript += "</script>" + "\r\n";
RegisterClientScriptBlock("ClientScript", strScript);
}
Page.RegisterStartupScript("", "<script>OpenWin()</script>");
{
this.HiddenField1.Value = "0";
string strScript = "<script>" + "\r\n";
strScript += "function OpenWin(){" + "\r\n";
strScript += "var str=window.open('TaskComment.aspx?TaskID=" + Request.QueryString["TaskID"].ToString().Trim() + "',document.form1.HiddenField1.value,'top=200,left=240,height=220,width=420,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no')" + "\r\n";
strScript += "if(str!=null) document.form1.HiddenField1.value=str" + "\r\n";
strScript += "if(str!=null) document.form1.submit()" + "\r\n";
strScript += "}" + "\r\n";
strScript += "</script>" + "\r\n";
RegisterClientScriptBlock("ClientScript", strScript);
}
Page.RegisterStartupScript("", "<script>OpenWin()</script>");
二、返回
Page.RegisterStartupScript("", "<script>window.close();window.opener.location.href=window.opener.location.href;</script>"); //关键注意了,重定向父窗口