I have a gridview user control and I am trying to Export the gridview data to a pdf. It seems that the fact that the grid is in a user control that the code that I am trying to use is not working? I dont know if this is the reason, I can only speculate from all the things Ive seen out there and nothing is working? Anybody have a clue what it could be?
Ive tried 10 different code snippets and none has worked.
This was the latest code I tried:
Response.Buffer = True
Response.ContentType = "application/pdf"
Dim sw As New StringWriter()
Dim hw As New HtmlTextWriter(sw)
myGridview.AllowPaging = False
Dim frm As New HtmlForm()
frm.Attributes("runat") = "server"
Dim sr As New StringReader(sw.ToString())
Dim pdfDoc As New iTextSharp.text.Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F)
Dim htmlparser As New HTMLWorker(pdfDoc)