注销/关闭父页面时关闭子弹出页面

时间:2014-07-30 09:03:49

标签: c# asp.net

如何在关闭/退出主页/窗口时关闭所有子窗口。我正在使用c#进行按钮点击事件。 在Logout按钮上单击主页面的事件我需要关闭所有其他子弹出窗口。 我的弹出页面名称是dmssview.aspx和后面的注销按钮点击代码

protected void BLogOut_Click(object sender, EventArgs e)
{
  Session["UserAuthentication"] = null;
  Response.Redirect("~/SM_Login.aspx");
}

请帮我关闭弹出页面

1 个答案:

答案 0 :(得分:0)

在注销按钮的点击事件中编写代码

private void btnExit_Click(object sender, EventArgs e)
     {        
            for (int i = Application.OpenForms.Count-1 ; i >= 0; i--)
            {
                if (Application.OpenForms[i].Name != "Menu")
                    Application.OpenForms[i].Close();
            }



     }