try { System.Web.UI.HtmlControls.HtmlForm form = new System.Web.UI.HtmlControls.HtmlForm(); string attachment = "attachment; filename=MQDeatils_Homer.xls"; Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/vnd.ms-excel"; StringWriter stw = new StringWriter(); HtmlTextWriter htextw = new HtmlTextWriter(stw); form.Controls.Add(gvMQReport); this.Controls.Add(form); form.RenderControl(htextw); Response.Write(stw.ToString()); Response.End(); } catch(Exception ex) {}
Response.Charset=""; //set the Charset to "" Response.ContentType="application/vnd.xls"; // Alter the content-type to this Response.Cache.SetCacheability(HttpCacheability.NoCache); // and set the cacheability
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)