Welcome Guest Search | Active Topics | Sign In | Register

Convert C# in ASPX to PDF Options
Michael
Posted: Sunday, August 5, 2012 12:45:44 PM
Rank: Member
Groups: Member

Joined: 8/5/2012
Posts: 12
Hi

I read some data from a SQL database with C# to an ASPX page. (I am not using GridView on the ASPX page). When I using the ASPXToPDF control and generate a PDF Page. I only get ASPX control in the PDF page. The data from SQL database is not on the PDF page, but it's on the ASPX page in the browser.

How can get the data from the SQL database to the PDF file, when I use C#, without using GridView?
eo_support
Posted: Sunday, August 5, 2012 12:54:36 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

That would be something you need to debug your code through. ASPXToPDF intercepts your ASPX output and send it off to HtmlToPdf.ConvertHtml. So if something is missing from the PDF file, then it's missing from your ASPX output. There can be cases where your ASPX output on your browser and the ASPX output when running under ASPXToPDF to be different. For example, if you dynamically load data from client side script then there will be a time delay before the page is loaded and the data eventually shows up, and if the HTML to PDF converter cuts in before that time delay then that data won't show up in your final result. This is just one out of a million scenarios so we cannot tell you how to get your data to show in your PDF file. You get it in your ASPX and it will show up.

Thanks!
Michael
Posted: Sunday, August 5, 2012 2:24:03 PM
Rank: Member
Groups: Member

Joined: 8/5/2012
Posts: 12
Hi

It was a time delay error. I solved it by call the "read data from database method" before I call ASPXToPDF1.RenderAsPDF(); in the Button1_Click event.

Code: C#
protected void Button1_Click(object sender, EventArgs e)
  {    
    Timesheet();
    ASPXToPDF1.RenderAsPDF();    
  }


Thanks again for good support.
eo_support
Posted: Sunday, August 5, 2012 2:33:55 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Great. Glad to hear that you got it working!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.