DataGrid2.DataSource =(DataTable)ViewState["oldDate"];
DataGrid2.DataBind();
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename="+ HttpUtility.UrlEncode(TitleLabel.Text + ".xls", System.Text.Encoding.UTF8));
HttpContext.Current.Response.Charset = "GB2312";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF7;
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
DataGrid2.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
DataGrid2.DataBind();
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename="+ HttpUtility.UrlEncode(TitleLabel.Text + ".xls", System.Text.Encoding.UTF8));
HttpContext.Current.Response.Charset = "GB2312";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF7;
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
DataGrid2.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();