[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 486
  • Last Modified:

Need to show real-time status, as long process is running

Using ASP.NET, and ajax update-panels already.  Have this 'Process' button, which starts
a long synchronous process, where it is doing some work with the database.  Based on items
selected, this process could take long time to finish, maybe 10-15 minutes.  I need to show
the user real-time, as parts of the long process is finished.  Have a label at the bottom,
but this shows up with all the detailed statuses, after the process is finished,
which really does not help the user.  What if it has hung up.

While the process is running, how do we update that label at the same time this process is
running.
0
tapdev72
Asked:
tapdev72
2 Solutions
 
AndyAinscowCommented:
Put the process into a thread - that informs the UI of the current status of process.

(Running a long process in the UI thread just blocks that until the process is finished - as you have found - UNLESS you can somehow interrupt the process at intervals and run a 'DoEvents' to process the message queue)
0
 
tapdev72Author Commented:
The processing is basically calling different stored procedures via ADO.NET till it finishes processing.
0
 
AndyAinscowCommented:
In C# there is an Application.DoEvents which will process messages

so call SP1, update your progress thingy then DoEvents, SP2, Process thingy, DoEvents, SP3, ......  where Process thingy is changing your label and other things to show the user how far it has progressed.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
tapdev72Author Commented:
DoEvents is for winforms. this is ASP.NET.
0
 
AndyAinscowCommented:
I know (one of the topics this question is in is C#).  I don't know ASP.net well enough to say if/what the equivalent command is called.
0
 
Rajar AhmedConsultantCommented:
0
 
VoloxCommented:
For ASP.net you'll essentially have to make your process button be a call to an async server side method - which would mean launching a thread to do the work.
The client will then have to fire a timer that makes a call to a status check method on the server.  The status check method would need to inspect something where the status of the thread is being stored while it processes through.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now