this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script>Ceshi();</script>", true); 這句代碼與下麵這段代碼放一起,不管是插在哪裡,這句代碼都無效,無法調用js 註釋掉 Pa ...
this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script>Ceshi();</script>", true);
這句代碼與下麵這段代碼放一起,不管是插在哪裡,這句代碼都無效,無法調用js
註釋掉
Page.Response.Clear();
Page.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(Path.GetFileName(filepath), System.Text.Encoding.UTF8));
Page.Response.AppendHeader("Content-Length", fiOutFile.Length.ToString());
就可以調用js,但是下麵這段導出excel的代碼就異常了。
求解。。。。
FileInfo fiOutFile = new FileInfo(filepath);
Page.Response.Clear();
Page.Response.ClearHeaders();
Page.Response.Buffer = false;
Page.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(Path.GetFileName(filepath), System.Text.Encoding.UTF8));
Page.Response.AppendHeader("Content-Length", fiOutFile.Length.ToString());
Page.Response.WriteFile(fiOutFile.FullName);
fiOutFile.Delete();
Page.Response.Flush();
Page.Response.End();