All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
GridView实用示例源码(可以导出Excel)_[Asp.Net教程]

Writer: delv Article type: Programming skills(编程技巧) Time: 2014/1/23 3:12:57 Browse times: 372 Comment times: 0

GridView实用示例源码(可以导出Excel)_[Asp.Net教程]


Head photo

Go homepage
Upload pictures
Write articles

GridView实用示例源码(可以导出Excel)_[Asp.Net教程]

最近在学GridView,但是找了很多教程但是都没有实例,特别是导出Excel的
,于是就自己整理写了一个,给象我一样的菜鸟们,如果正在学Asp.net2.0的同僚们可以看看阿!高手不要见笑哦!

GridView实用源码(可以导出Excel) VS2005中GridView的自定义分页,单选、多选、排序、自增列及可以导出Excel的简单应用源码多选时,只有全部选中时“多选”才选中


导出Excel部分的源码
//导出到Execl
protected void Button3_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
Response.ContentType = "application/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}

下载地址

来源:http://liudao.cnblogs.com/





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.