All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
SQL注入技术和跨站脚本攻击的检测_[SQL,Server教程]
ASP.NET中设置默认提交按钮的代码_[Asp.Net教程]
SqlServer数据库触发器实例讲解_[SQL,Server教程]
PHP编程中计算时间差的几种方法_php资料_编程技术
PHP,PEAR简介_php资料_编程技术
正确理解C#中的ref关键字_.net资料_编程技术
在global.asax中实现URL重写(应用)_[Asp.Net教程]
PHP实例:用PHP将mysql数据表转换为excel文件格式_[PHP教程]
ASP.NET,FORUMS换肤流程_[Asp.Net教程]
GridView,批量删除,自定义分页,定位页码_[Asp.Net教程]
Reading number is top 10 pictures
这两天,中国人民到处都可以“看海”了
青春清纯美女大集合2
The money of more than 100 countries and regions4
中国文革时期的色情图片2
人物写真-谢楠
9.3阅兵全景图4-陸海空现代化兵种方阵梯队
From China fortress sora aoi3
The real super beauty5
程序员的悲哀
战场废物1
Download software ranking
美女游泳记
Unix video tutorial2
变速齿轮3.26
matrix1
Boxer vs Yellow4
The Bermuda triangle2
美女写真2
Proficient in JavaScript
尖东毒玫瑰B
Sora aoi, the maid, students' uniforms
归海一刀 published in(发表于) 2014/1/30 1:25:18 Edit(编辑)
ASP.NET页面数据导出到Excel或Word_[Asp.Net教程]

ASP.NET页面数据导出到Excel或Word_[Asp.Net教程]

ASP.NET页面数据导出到Excel或Word_[Asp.Net教程]
private void btnMIME_Click(object sender, System.EventArgs e)
{
BindData();
Response.ContentType = "application/vnd.ms-Excel";
Response.AddHeader("Content-Disposition", "inline;filename="
+ HttpUtility.UrlEncode("下载文件.xls",Encoding.UTF8 ) );

//如果输出为word,修改为以下代码
//Response.ContentType = "application/ms-word"
//Response.AddHeader("Content-Disposition", "inline;filename=test.doc")
StringBuilder sb=new StringBuilder();
System.IO.StringWriter sw = new System.IO.StringWriter(sb);
System.Web.UI.HTMLTextWriter hw = new System.Web.UI.HTMLTextWriter(sw);
sb.Append("");
dgShow.RenderControl(hw);
sb.Append("");
Response.Write(sb.ToString());
Response.End();
}
1.若DataGrid中有按钮列,则在导出前应先将其隐藏.
2.若DataGrid有分页,而又要打印所有数据的话就应先取消分页.


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.