satheesh babu

satheesh babu

  • NA
  • 128
  • 309k

exporting gridview to pdf and not exporting the text box values which is inside the grid view?

Apr 28 2011 6:10 AM
HI all,

  I am using below code to export data grid view data to PDF and its working fine and i have a editable text box in the grid view(to enter payment amount). But this text box amount is not exporting to PDF.

Please help me on this issue. Below is my code

using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.html;
using iTextSharp.text.html.simpleparser;
using System.Text;
using System.IO;

 Response.ContentType = "application/pdf";
  Response.AddHeader("content-disposition", "attachment;filename=PENAL_INT_CUSTOMER_ID_FROMDATE_TOdATE.pdf");
  Response.Cache.SetCacheability(HttpCacheability.NoCache);
  StringWriter sw = new StringWriter();
  HtmlTextWriter hw = new HtmlTextWriter(sw);
  dgvPenal.AllowPaging = false;
  dgvPenal.DataBind();
  dgvPenal.RenderControl(hw);
  StringReader sr = new StringReader(sw.ToString());
  Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
  HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
  PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
  pdfDoc.Open();
  htmlparser.Parse(sr);
  pdfDoc.Close();
  Response.Write(pdfDoc);
  Response.End();

Please help me...

Thank you

Answers (1)