首页 新闻 会员 周边 捐助

大神们,C# WEB开发 怎样将隐藏的gridview列导出到excel

0
[已关闭问题] 关闭于 2017-02-20 09:42

下面是我的导出到excel代码,不导出前台中隐藏的列。

 

Gv_jh.AllowPaging = false;
BindGridView(sSearch);
Response.Clear();
Response.Buffer = true;

Response.Charset = "GB2312";
Response.ContentEncoding = Encoding.UTF8;

Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
Response.ContentType = "application/ms-excel";
this.EnableViewState = false;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
grid.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
Gv_jh.AllowPaging = true;
BindGridView(sSearch);

tgq2012888的主页 tgq2012888 | 菜鸟二级 | 园豆:202
提问于:2017-02-20 08:30
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册