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