码迷,mamicode.com
首页 > Windows程序 > 详细

C#后台调用js方法无效果,未解决。

时间:2017-07-01 13:36:31      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:效果   his   write   headers   encode   rtu   text   inf   let   

 

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

C#后台调用js方法无效果,未解决。

标签:效果   his   write   headers   encode   rtu   text   inf   let   

原文地址:http://www.cnblogs.com/suxiaBlogs/p/7102072.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!