第一次偶然出现的“System.Web.dll”类型的异常
GLILG 2014-12-20 12:44:04 在 System.Web.HttpException 中第一次偶然出现的“System.Web.dll”类型的异常
在 System.Web.HttpUnhandledException 中第一次偶然出现的“System.Web.dll”类型的异常
在 System.Web.HttpUnhandledException 中第一次偶然出现的“System.Web.dll”类型的异常
我在导出exl是遇到了这个问题
private void Export(string FileType, string FileName)
{
GridView1.Columns[9].Visible = false; //导出时隐藏操作列
GridView1.BottomPagerRow.Visible = false; //隐藏分页行
Response.Clear();
Response.Buffer = true;
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); // 中文
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.GridView1.RenderControl(oHtmlTextWriter);
Response.Output.Write(oStringWriter.ToString());
Response.Flush();
Response.End();
}