473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Chaging a UI control in a child thread

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
Nov 19 '05 #1
3 1865
"Vinicius Bellino" <vb******@uol.com.br> wrote in message
news:93*************************@posting.google.co m...
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/de...pplication.asp

Make a Progress Indicator For Slow-Loading Pages
(http://www.aspnetpro.com/NewsletterA...200308bm_l.asp)
DESIGN PATTERNS: Asynchronous Wait State Pattern in ASP.NET
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

John Saunders
Nov 19 '05 #2
when the popup window detects done, have client script in the popup update
the main page.

"Vinicius Bellino" <vb******@uol.com.br> wrote in message
news:93*************************@posting.google.co m...
| 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
Nov 19 '05 #3
I just submit the parent window and it worked fine!
John, thanks for the links anyway, they're helpful!

Vinicius Bellino

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Srikanth Mandava | last post by:
Hi! When a signal handler is registered in the main thread and "control-c" is entered, the child thread is getting the KeyboardInterrupt exception(The documentation says the main thread MUST...
23
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the...
2
by: frederik12 | last post by:
Hi all, Today I downloaded and installed VS 2005 C# Express Edition (.NET framework 2.0). I'm very pleased about this new product. In my current application I'm using the WebBrowser control in...
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
5
by: Peted | last post by:
Just some threading questions 1. in a MDI app if you have multiple child forms, does each child form run in its own thread ? Eg do you get error trying to update one control on form1 from...
2
by: =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= | last post by:
vs2005, c# Trying to understand why one way works but the other doesnt. I have not tried to create a simpler mdi/child/showdialog app for posting purposes (I think even this would not be so small...
3
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I using BackgroundWorker control in my Windows Forms. In my form, I have a SplitterPanel. In DoWork event , I create controls child, and in ProgressChanged event I try add...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.