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

webform listview的数据怎么导出为Excel

2012-08-09 
webform listview的数据如何导出为Excel网上的都是winform的webform的listview 没有column属性~~~Response

webform listview的数据如何导出为Excel
网上的都是winform的 webform的listview 没有column属性~~~
  Response.Charset = "GB2312";
  Response.ContentEncoding = System.Text.Encoding.UTF7;
  Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("CircPromblems.xls", Encoding.UTF8).ToString());
  Response.ContentType = "application/ms-excel";
  this.EnableViewState = false;
  StringWriter tw = new StringWriter();
  HtmlTextWriter hw = new HtmlTextWriter(tw);
  this.lv_MVCirc.RenderControl(hw);
  Response.Write(tw.ToString());
  Response.End();
上面的方法只能导出当前显示的listview的数据 不能导出数据源的数据~ 求各位大神帮忙啊

[解决办法]
能导出listview的数据就是成功以99%了啊,最简单的就是放个隐藏的listview,把数据源的数据绑给它,那它就具有数据源的所有数据了,然后就可以导出了

热点排行