62,244
社区成员




private void Export(string FileType, string FileName)
{
Response.Clear();
Response.Charset = "Big5";
string s = HttpUtility.UrlEncode(System.Text.UTF8Encoding.UTF8.GetBytes(FileName));
Response.AppendHeader("Content-Disposition", "attachment;filename="+s);
Response.AddHeader("Content-type", "application/x-msdownload");
Response.ContentType = "application/octet-stream";
System.IO.StringWriter stringwrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringwrite);
GridView1.AllowPaging = false;
this.DataBinds();
GridView1.RenderControl(htmlWrite);
Response.Write(stringwrite.ToString());
Response.End();
GridView1.AllowPaging = true;
this.DataBinds();
}
Export("ms-excel","產品.xls");