Posted on: 6/3/2014 7:23:13 AM | Views : 418



Hi am trying to export to pdf the data from grid view
here is my code
using iTextSharp.text; using iTextSharp.text.pdf; using iTextSharp.text.html; using iTextSharp.text.html.simpleparser; using System.IO;
protected void btnExportPDF_Click(object sender, EventArgs e) { Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache);
//StreamWriter sw = new StreamWriter(); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); gvrpaList.AllowPaging = false; gvrpaList.DataBind(); gvrpaList.RenderControl(hw); //StreamReader sr = new StreamReader(sw.ToString()); StringReader sr = new StringReader(sw.ToString()); Go to the complete details ...