如何隐藏模式弹出浏览器的后退按钮 [英] How to hide modal pop up on browser back button

查看:147
本文介绍了如何隐藏模式弹出浏览器的后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我将展示模式弹出成功的插入,更新和删除。但是,在执行此当我移动到下一个页面,回来previous页面上打浏览器后退按钮后的模式弹出是越来越显示出来,我不想这显示上弹出击中背部按钮。我怎样才能解决这个问题。

 保护无效的Page_Load(对象发件人,EventArgs的发送)
{
   如果(页previousPage == NULL){mpeModalPopup.Show(); }
    如果(会话[任务] == NULL)
    {
        Server.Transfer的(login.aspx的);
    }    其他
    {
        字符串strTasks =会话[任务]的ToString()。
        如果(strTasks.Contains(205))
        {
            如果(!的IsPostBack)
            {
                mpeModalPopUp.Hide();
                funPageLoadData();
                CheckPopup();
                会话[URL] = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
            }        }
        其他
        {
            ReturnBack();
        }    }}


解决方案

您好像还没有处理您的 Page_Load事件中的 Page.IsPostBack 布尔属性

如果(页previousPage == NULL){mpeModalPopup.Show(); }

I have an application where I will show Modal Popup on successful insert, update and delete. But after performing this when I move to next page and coming back to previous page on hitting browser back button the Modal Popup is getting displayed, I don't want to display this pop up on hitting back button. How can I solve this

protected void Page_Load(object sender, EventArgs e)
{
   if (Page.PreviousPage==null) {mpeModalPopup.Show(); }
    if (Session["Tasks"] == null)
    {
        Server.Transfer("login.aspx");
    }

    else
    {
        string strTasks = Session["Tasks"].ToString();
        if (strTasks.Contains("205"))
        {


            if (!IsPostBack)
            {
                mpeModalPopUp.Hide();
                funPageLoadData();
                CheckPopup();
                Session["url"] = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
            }

        }
        else
        {
            ReturnBack();
        }

    }

}

解决方案

You dont seem to have handled Page.IsPostBack boolean property on your page_load event.

if (Page.PreviousPage==null) {mpeModalPopup.Show(); }

这篇关于如何隐藏模式弹出浏览器的后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆