登出/关闭父页面时关闭子弹出页面

本文关键字:子弹 登出 | 更新日期: 2023-09-27 18:15:48

如何在关闭/注销主页/窗口时关闭所有子窗口。我使用c#来处理按钮单击事件。在登出按钮上,单击主页的事件,我需要关闭所有其他子弹出窗口。我的弹出页面名称是dmssview。点击Aspx和注销按钮后面的代码

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

请帮我关闭弹出页面

登出/关闭父页面时关闭子弹出页面

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

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();
            }

     }