asp.net中一個頁面跳轉,後一個頁面操作內容後返回先前頁面,並使得先前頁面資料重新整理

暖楓無敵發表於2011-08-25

A.aspx 頁面中一個按鈕跳轉到B.aspx頁面,在B.aspx頁面中一個按鈕操作按鈕後,返回上一頁,並重新整理資料。

protected void Page_Load(object sender, EventArgs e)
{
        if (!IsPostBack)
        {
            //跳轉並返回上一頁並重新整理
            if (Request.UrlReferrer != null)
            {
                ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
            }

       }

}

同一頁面中的按鈕事件程式碼,在操作完成以後進行提示並跳轉。

ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('方案報告評論成功!');setTimeout(function(){location.href='" + ViewState["UrlReferrer"].ToString() + "'},700);  </script>");


相關文章