prabhu p

prabhu p

  • NA
  • 181
  • 114.5k

asp.net convert panel data and gridview data to word.doc

Sep 4 2014 11:33 AM
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();


but i getting error while add panel data that have calender function
error-Extender control 'CalendarExtender1' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors().
Parameter name: extenderControl