我也用以上方法將數據導入EXCEL,但顯示的EXCEL工作表一片空白,請問為什麼?原碼如下:
Response.ContentType ="application/vnd.ms-excel";
//從Content-Type header中去除charset
Response.Charset = "";
// this.EnableViewState = false;
System.IO.StringWriter tw =new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw=new System.Web.UI.HtmlTextWriter(tw);
datagrid1.RenderControl(hw);
//DataGrid1.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
Response.ContentType ="application/vnd.ms-excel";
//從Content-Type header中去除charset
Response.Charset = "";
// this.EnableViewState = false;
System.IO.StringWriter tw =new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw=new System.Web.UI.HtmlTextWriter(tw);
datagrid1.RenderControl(hw);
//DataGrid1.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
解决方案 »
- 请问:如何解决div 图层 被其他 网页元素挡住的问题
- Ext.Viewport动态加载数据?
- 数据存储问题,求教前辈们
- 100分求一疑难问题
- 为什么我的删除提示文字不会出来?大家帮我看看
- javascript 怎么得到一个链接返回的值(true或false)
- 关于在用户控件中无法执行DataGrid1_ItemDataBound事件
- 请问DataSet如何以多个表作为数据源,将多个表的字段在一个DataList中显示或者编辑?
- 请问: 在服务器资源管理器中,数据连接, 报ADO错误:没有注册类别 如何解决?
- 支付宝
- 关于字符文本中字符太多的错误?
- treeview的自动生成,请各位高手指教.
好象是这样