Response.AddHeader("Content-Disposition", "attachment; filename=test");
//Response.Charset = "UTF-8";
Response.Charset = "Unicode";
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
this.DataGrid.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
//Response.Charset = "UTF-8";
Response.Charset = "Unicode";
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
this.DataGrid.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
解决方案 »
- 如何在一个<iframe>中的页面点击取消同时也隐藏引用页面的某个层
- 看看吧,这是母板页有啥错
- 怎样实现类似于winform的模式窗体的功能?
- 给DataTable添加超链接列问题
- 高手请进!!!!!!!!!!!!!
- 2个系统之间的变量传递问题?
- Web项目在另一台机器上无法打开?---在线等待,解决马上结贴
- GridView内容循环滚动 ,散分 散分散分,, 100%结贴
- 使用HttpModule记录当前登陆人的ID
- 代碼的困惑!有一大堆asp的oa 工作流模板是xml,用他做什麽呢?
- 大家谈谈泛型编程在.net中的影响~~~见者有分~~~:)
- xml与Dataset交互了,但是无法更新到数据库!(~急)
在服务器端生成 Excel文件,然后发送到客户端浏览器(此时需要添加一些 HTTP 头,就像popu2(混口饭吃) 说的那样)。