Click here to Skip to main content
14,927,693 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i export gridview data into pdf using the code below,

C#
protected void pdfLinkBtn_Click(object sender, EventArgs e)
      {
          const string attachment = "attachment; filename= grdDetail.pdf";

          Response.AddHeader("content-disposition", attachment);
          Response.ContentType = "application/pdf";
          Response.Cache.SetCacheability(HttpCacheability.NoCache);
          Response.ClearContent();

          StringWriter sw = new StringWriter();
          HtmlTextWriter htw = new HtmlTextWriter(sw);

          studentReportGrid.RenderControl(htw);

          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();


      }

But, in my gridview two columns data bind from client side.so this data don't
convert to pdf from server side.how to export whole data in gridview to
pdf?can export the gridview data to pdf using script?

Thanks..
Posted

1 solution

   
Comments
hasbina 11-Dec-12 23:58pm
   
i want client side script.not from server side

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900