Chaging a UI control in a child thread

  • Thread starter Thread starter Vinicius Bellino
  • Start date Start date
V

Vinicius Bellino

Hi All,

Is there a way to change a property of an UI control, such as the
enabled property of a button, in a child thread?

I mean, my code runs a long process, and because I wanted to show the
status in another popup window, I created a new (child) thread to run
the long process and I let the main thread open a new popup with
auto-refresh to show the status, using a shared Session variable to
pass the current status between these threads. Before starting the
long process, the main thread sets some UI controls to disabled, after
this process finishes in the child thread, I'd like to enable these
controls again. How could I do it?

Thanks in advance,

Vinicius
 
Vinicius Bellino said:
Hi All,

Is there a way to change a property of an UI control, such as the
enabled property of a button, in a child thread?

I mean, my code runs a long process, and because I wanted to show the
status in another popup window, I created a new (child) thread to run
the long process and I let the main thread open a new popup with
auto-refresh to show the status, using a shared Session variable to
pass the current status between these threads. Before starting the
long process, the main thread sets some UI controls to disabled, after
this process finishes in the child thread, I'd like to enable these
controls again. How could I do it?

You can't have a child thread touch the original Page or Request. As soon as
the Page finishes rendering, the Page, Request, Response, Context, etc.
objects are destroyed. Your child thread is then left playing with garbage.
Consider some of the following:

Indicating Progress
http://msdn.microsoft.com/library/d...serverprogressfromaspnetclientapplication.asp

Make a Progress Indicator For Slow-Loading Pages
(http://www.aspnetpro.com/NewsletterArticle/2003/08/asp200308bm_l/asp200308bm_l.asp)
DESIGN PATTERNS: Asynchronous Wait State Pattern in ASP.NET
http://msdn.microsoft.com/msdnmag/issues/03/12/designpatterns/default.aspx

John Saunders
 
when the popup window detects done, have client script in the popup update
the main page.

| Hi All,
|
| Is there a way to change a property of an UI control, such as the
| enabled property of a button, in a child thread?
|
| I mean, my code runs a long process, and because I wanted to show the
| status in another popup window, I created a new (child) thread to run
| the long process and I let the main thread open a new popup with
| auto-refresh to show the status, using a shared Session variable to
| pass the current status between these threads. Before starting the
| long process, the main thread sets some UI controls to disabled, after
| this process finishes in the child thread, I'd like to enable these
| controls again. How could I do it?
|
| Thanks in advance,
|
| Vinicius
 
I just submit the parent window and it worked fine!
John, thanks for the links anyway, they're helpful!

Vinicius Bellino
 
Back
Top