-
GridView中的数据导出到Excel中
1 Response.Clear();
2 Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
3
4 Response.Charset = "";
5
6 // If you want the option to open the Excel file without saving than
7
8 // comment out the line below
9
10 //Response.Cache.SetCacheability(HttpCacheability.NoCache);
11
12 Response.ContentType = "application/vnd.xls";
13
14 System.IO.StringWriter stringWrite = new System.IO.StringWriter();
15
16 System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
17
18 gridView.RenderControl(htmlWrite);
19
20 Response.Write(stringWrite.ToString());
21
22 Response.End();
1public override void VerifyRenderingInServerForm(Control control)
2 {
3
4 // Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.
5
6 }
-
相关阅读:
移动端和pc端的判断,不同端做不同的处理
easyUI combobox的使用
[Codeforces #196] Tutorial
[Codeforces #174] Tutorial
[Codeforces #190] Tutorial
[Codeforces #211] Tutorial
[Codeforces #192] Tutorial
[BZOJ 3196] 二逼平衡树
[BZOJ 1058] 报表统计
[P3709] 大爷的字符串题
-
原文地址:https://www.cnblogs.com/weiweictgu/p/414894.html
Copyright © 2020-2023
润新知