Response.AddHeader("content-disposition", "attachment;filename=Export.doc"); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.word"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite); System.Web.UI.HtmlControls.HtmlForm frm = new System.Web.UI.HtmlControls.HtmlForm(); pnlPerson.Parent.Controls.Add(frm); GridView1.Parent.Controls.Add(frm); frm.Attributes["runat"] = "server"; frm.Controls.Add(pnlPerson); frm.Controls.Add(GridView1); frm.RenderControl(htmlWrite); // frm.RenderControl(strBody); Response.Write(stringWrite.ToString()); Response.End();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)