Thread communication on web client

BlueBoy33
BlueBoy33 used Ask the Experts™
on
Dear Expoerts.

I use 3 threads to kick of 3 different processes on the database and was wondering if it would be possible to show the progress of these threads updating 3 labels as the threads complete.

It's is a web application developed in C#

Any ideas would be greatly appreciated.

Thanks in advance.

Neil.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
If you were developing a winforms app it would be reasonably easy to use a delegate on the target form to allow another thread to update the labels... but its a completely different story with webapps.  Your threads will be running on the server, and your labels are on your client in the browser, and worse yet your browser has to initiate the interaction with the server (i.e. the server can't say "oh, the threads completed, let me tell the browser!").
In honesty, threads are typically used on webservers more for long running purposes that don't need to return results; i.e. running long database transactions or sending emails.
The best you can do is make some kind of client-side script to check the progress of the threads.  If you can have the C# code kicking off each process you could try sharing a variable between client-side JavaScript and your server-side C# so the JavaScript can check periodically for the thread progress... it's a little messy and will take some reading though.
This blog post looks interesting and seems to provide good examples of this, but I haven't read it through and through:
http://iridescence.no/post/Sharing-Variables-Between-JavaScript-and-C.aspx 
Good luck!
-w00te

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial