62,074
社区成员
发帖
与我相关
我的任务
分享
Response.Charset = "GB2312";
Response.ContentType = "application/vnd.ms-excel";
Response.Write(data);
string data = WriteDatagridToCsv(this.GridView1);
string filenames = DateTime.Now.ToFileTime().ToString() + ".csv";
string temp = string.Format("attachment;filename={0}", filenames);
Response.ClearHeaders();
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.AppendHeader("Content-disposition", temp);
Response.HeaderEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.Charset = "GB2312";
Response.ContentType = "application/vnd.ms-excel";
Response.Write(data);
Response.End();
string filenames = DateTime.Now.ToFileTime().ToString() + ".csv";
//string temp = string.Format("attachment;filename={0}", filenames);
string webpath = Server.MapPath("~/csvdata/") + filenames;
File.WriteAllText(webpath, data, Encoding.GetEncoding("GB2312"));
Response.Redirect("~/csvdata/" + filenames);