When a user clicks a button, I use the ThreadPool.QueueUserWorkItem
to spawn a thread that kicks off a long running process. I would like to make a button visible when the thread is completed so that user can click on it.
Is there a completed event in ThreadPool
What am I trying to do?
One of the pages has a button when clicked connects to a WS and kicks off a long running process that creates a file. During the processing time, I would like to show a progress bar to the user. Once the processing is completed, I would like to provide a link to the file that was created. Many users will be clicking on the button the same time that creates different files. I guess you would call this a single request that can be implemented using the Async approach?
Quick Qs about Async pages:
The MSDN link has the following code:
AddOnPreRenderCompleteAsync ( new BeginEventHandler(MyBeginMethod), new EndEventHandler (MyEndMethod) );
It appears that the MyBeginMethod
is kicked off on Page Load, will the same code snippet work for me if i want to initiate the async process on a button click?
- Can I access the UI controls in
MyBeginMethod
andMyEndMethod
methods (so that I can make a download file button visible on the process completion? Or does a different thread own these controls?