在C#中要求打开模式窗口,在关闭模式窗口时父窗体刷新
父窗体RoleManage.aspx代码如下:
<script type= "text/javascript" language ="javascript">
function SetPropotion()
{
if(window.showModalDialog("SetDiscount.aspx","","status=no;dialogWidth=515px;dialogHeight=300px;menu=no;resizeable=yes;scroll=yes;center=yes;edge=raise")=="OK")
{
document.location.href="RoleManage.aspx";
}
}
</script>
子窗体SetDiscount.aspx的主要代码如下:
<form id="form1" runat="server" target="ifrm">
</form>
<iframe style="DISPLAY: none" name="ifrm" width="750" height="0"></iframe>
子窗体的后置代码如下:
protected void btnRet_ServerClick(object sender, EventArgs e)
{
Response.Write("<script> window.returnValue='OK';self.close();</script>");
}