Hi Mudassar, I have a question for you on the subject to export the contents of a panel to pdf, can export the panel even if it has some controls such as GridView, DropDownList, etc.? I have the following code:
protected void btnExport_Click (object sender, EventArgs e)
{
Response.ContentType = "application / pdf";
Response.AddHeader ("content-disposition", "attachment; Panel.pdf filename =");
HtmlForm HtmlForm form_nuevo = new ();
form_nuevo.Attributes.Add ("runat", "Server");
form_nuevo.Controls.Add (GridView1);
Response.Cache.SetCacheability (HttpCacheability.NoCache);
StringWriter sw = new StringWriter ();
HtmlTextWriter hw = new HtmlTextWriter (sw);
pnlPerson.RenderControl (hw);
StringReader sr = new StringReader (sw.ToString ());
Document pdfDoc = new Document (PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker HTMLParser = new HTMLWorker (pdfDoc);
PdfWriter.GetInstance (pdfDoc, Response.OutputStream);
pdfDoc.Open ();
htmlparser.Parse (sr);
pdfDoc.Close ();
Response.Write (pdfDoc);
Response.End ();
}
I had to integrate the GridView to a form that is created at runtime because I said I should be in one, but even so when I export the file I get blank, really I do not know what I'm doing wrong and I have many controls that I have to export
thanks for your help