lblError.Visible = false; Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=BorrowerReport.xls"); Response.Charset = ""; // If you want the option to open the Excel file without saving than // comment out the line below // Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; StringWriter stringWrite = new System.IO.StringWriter(); HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); datagrid.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End();
public override void VerifyRenderingInServerForm(System.Web.UI.Control control) { }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)