首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

gridview打印解决办法

2011-12-29 
gridview打印gridview打印出力面的数据包括分页当中未被显示出来的数据呢?[解决办法]重新取数据,将取出的

gridview打印
gridview打印出力面的数据包括分页当中未被显示出来的数据呢?

[解决办法]
重新取数据,将取出的数据配置成HTML字符串,然后导出
public static void GenerateByHtmlString(string Typename, string TempHtml)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Charset = "utf-8 ";
string Filename = Typename + ".xls ";
HttpContext.Current.Response.AppendHeader( "Content-Disposition ", "online;filename= " + Filename);
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding( "utf-8 ");
HttpContext.Current.Response.ContentType = "application/ms-excel ";
//this.EnableViewState = false;
HttpContext.Current.Response.Write(TempHtml);
HttpContext.Current.Response.End();
}

Typename为导出的文件名,TempHtml为HTML字符串

热点排行