0
在我的應用我有我已經通過下面的代碼實現對Excel文件導出後Refresing頁:到Response.End()
Response.ClearContent();
Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", pFileName));
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
FileInfo myFile = new FileInfo(fullfilePath);
Response.WriteFile(myFile.FullName);
Response.Flush();
HttpContext.Current.ApplicationInstance.CompleteRequest();
Response.End();
從我的主頁,其中「導出到Excel」按鈕存在上的該按鈕的點擊我已經如下registerred一個Javascript:
ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script language=JavaScript>window.location.href('GenerateExcel.aspx');</script>");
和GenerateExcel.aspx
頁的頁面加載我寫導出文件,我上面貼的代碼。此代碼適用於我,當用戶點擊「導出到Excel」按鈕窗口文件打開,保存&關閉彈出窗口是Apeear和用戶可以保存或打開文件,但我的問題在於,該文件後打開彈出我想刷新主頁面。我試過註冊javascript,但Response.End
nothiing正在工作。 請幫幫我。
它更好地使一個處理程序發送文件使用簡單的鏈接,而不是回發,然後你可以使你喜歡的其他thniks。 – Aristos