Chaging a UI control in a child thread

  • Thread starter Vinicius Bellino
  • 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
 
J

John Saunders

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
 
B

bruce barker

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
 
V

vbellino

I just submit the parent window and it worked fine!
John, thanks for the links anyway, they're helpful!

Vinicius Bellino
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top