- ·asp.net 实现购物车详细代码·从零开始学ASP.NET(基础篇)·ASP.NET 2.0中Gridview控件高级技巧·ASP.NET中使用TreeView控件·ASP.NET程序中常用的三十三种代码·在ASP.NET 2.0中实现数据的绑定·ASP.NET2.0+SQL Server2005构建多层应·用ASP.NET 2.0实现AJAX风格的Web开发·ASP.NET Web应用程序的简单AJAX实现·ASP.NET2.0数据库入门之SQL Server
| Response.Clear(); Response.Buffer= true; Response.Charset="utf-8";//下面这行很重要, attachment 参数表示作为附件下载,您可以改成 online在线打开//filename=FileFlow.xls 指定输出文件的名称,注意其扩展名和指定文件类型相符,可以为:.doc || .xls || .txt ||.htmResponse.AppendHeader("Content-Disposition","attachment;filename=FileFlow.xls");Response.ContentEncoding=System.Text.Encoding.GetEncoding("utf-8");//Response.ContentType指定文件类型 可以为application/ms-excel || application/ms-word || application/ms-txt || application/ms-html || 或其他浏览器可直接支持文档Response.ContentType = "application/ms-excel";this.EnableViewState = false; |
| System.IO.StringWriter oStringWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); |
| this.RenderControl(oHtmlTextWriter); //this 表示输出本页,你也可以绑定datagrid,或其他支持obj.RenderControl()属性的控件Response.Write(oStringWriter.ToString());Response.End(); |

