前台页面为 子页面为一个按钮:
<form id="form1" runat="server">
<div>
<asp:Button runat="server" ID="Bt_Add" Text="添加" Width="80px" Height="20px" OnClick="Bt_Add_Click" />
</div>
</form>
在后台onClick中添加:
protected void Bt_Add_Click(object sender, EventArgs e)
{
//你要做的事情然后刷新父页面
//刷新父页面
ClientScript.RegisterStartupScript(this.GetType(), "ReLoad", "ReLoad();", true);
}
在子页面加入javascript脚本
<script type="text/javascript" language="javascript">
function ReLoad() {
if(window.opener)
{//如果父页面还在的话
window.opener.location.reload();//先刷新父页面
window.opener = null;//
window.close();//这两句是为了不出现提示
}
}
</script>
点击时会摔新父页面。在关闭本页面!