DataGrid 控件导出到Excel

来源:互联网 发布:全球网络哪里要翻墙 编辑:程序博客网 时间:2024/04/30 01:56
Response.Clear();
Response.Buffer=true;
Response.ContentType="application/vnd.ms-excel";
Response.Charset="";
this.EnableViewState=false;


stringwriter  sw=new  stringwriter();
HtmlTextWriter  htw=new  HtmlTextWriter(sw);
YoueDataGrid.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();

 
原创粉丝点击