开发者

jQuery Progress bar with ASP.NET Web Forms

开发者 https://www.devze.com 2023-02-10 11:20 出处:网络
I am attempting to use a jQuery progress bar in my ASP.NET Web Forms application. My goal is this: A user clicks a button, which then by ajax sends off a request which does a bunch of stuff (i.e. gen

I am attempting to use a jQuery progress bar in my ASP.NET Web Forms application. My goal is this:

A user clicks a button, which then by ajax sends off a request which does a bunch of stuff (i.e. generating some PDFs) Since this PDF generation is a little time consuming, I would love to have a jQuery progress bar keep up to date on how many of the PDFs out of the total are completed. How would I go about starting up this process on an AJAX request and then poll the process every so often to see how it is doing? What kind of considerations do I need to take int开发者_开发问答o account for multiple users using this application at one time? Sometimes I get my head all wrapped up and backwards on how the browser should talk to the server and so forth that it could be a simple solution that I am not seeing.

Any direction would be much appreciated. Thank you so much for all of your help and your time.


Just to keep anyone interested posted with what I did:

I used one AJAX call to start up the PDF generation process. Each step of the process I update a database record with the generation status. I then use javascript setTimeout() to call another ajax method that retrieves the record and display the current progress. Once the generation is done, the status checker ajax call is stopped.

I know this is not ideal, if this site was to get thousands of hits, that is a lot of read and writes to the DB just to do a simple progress bar. It is a solution, not even a great one in my mind, so if anyone has something they have done I would be more than willing to look into it. Thank you all for your help and thoughts on the matter.


Instead of using a jquery progressbar, you might try starting the PDF generation in a separate process, and then using an <asp:Timer> to update the page with the progress.

0

精彩评论

暂无评论...
验证码 换一张
取 消