4

I am generating a PDF using the response object. The code actually renders the HTML to the PDF. PDF generation time is not fixed, so I want to show a preloader process (processing/loading) during this time using Ajax.

When I start the PDF generation process on button click, then it will start the preloader process, but after the completion of PDF getting generated, the preloader process is not getting stopped.

Also, suppose I want to clear the data in the textboxes on the page, then that is not getting cleared.

What do I need to do to solve these problems.

Here is code:

Dim Response As System.Web.HttpResponse = System.Web.HttpContext.Current.Response
Response.Clear()
Response.ClearHeaders()
Response.ClearContent()
Response.ContentType = "application/pdf"
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Me.txtReportSetPDFName.Text.Replace(" ", "_") + ".pdf")
Response.AppendHeader("Content-Length", FileLen(sFilePath).ToString)
Response.WriteFile(sFilePath)
lucian.pantelimon
  • 3,673
  • 4
  • 29
  • 46
Jugal Kundal
  • 41
  • 1
  • 5

1 Answers1

2

Are you using

response.End();

If yes, then you need to do your textbox clearing and stopping the loader before you call

response.End();

Hope it helps. Don't forget to upvote it if it solves you problem. Thanks.. :)

Avishek
  • 1,896
  • 14
  • 33