Hi all,
I assume this is a simple question for you. Here we go:
On my .aspx page, I have a label Label1 and a button Button1 surrounded by an Update Panel.
A click on the Button invokes the code-behind method that looks as follows:
protected void Click(object sender, EventArgs e) {
ThreadProc("Hello");
Thread.Sleep(2000);
ThreadProc("Hello2");
Thread.Sleep(2000);
ThreadProc("Hello3");
}
void ThreadProc(string info) {
Label1.Text = info;
// UpdatePanel1.Update();
}
What I would like to see is that the Label is updated and displayed (rendered) according to what the code does. So it should Hello, Hello2 for 2 seconds and finally Hello3 should be displayed. It appears that only the last Hello3 is rendered. Can someone explain why this happens and how I can implement my idea?
The overall task I try to accomplish is that a click on the button calls a multithreaded function that queries different pages. Whenever a worker thread returns from his mission, it is supposed to update a gridview with the newly added record. Here, the issue is the same: only after all threads have done their job, the webpart is updated.
Thanks a lot for any help!
Cheers Christoph