Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 952475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:53:59+00:00 2026-05-15T23:53:59+00:00

I assume this is a simple question for you. Here we go: On my

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:54:00+00:00Added an answer on May 15, 2026 at 11:54 pm

    Because the code is running on the web server, it processes the entire method Click() before rendering the final page and sending it to the client’s web browser. Therefore, you only see the final results, which has “Hello3” as the Label1.Text.

    The effect that Thread.Sleep(2000) has on your code is that the HTTP response from the web server takes 4.x seconds instead of only a fraction of a second if you left it out.

    However, if you want to see each update to the Label1.Text, you can do that with an asynchronous AJAX call.

    • AJAX Tutorial
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

pretty simple question I have here, but I couldn't find the answer: Assume I
This a pretty simple question (I assume). Probably a repost, but I couldn't find
I have a simple question that I assume does not have a simple solution.
Here is a simple example: Assume I have a customer table that has a
Assume I have a class that looks like this: class Sample { public string
This may be a silly question but... Say you have a sentence like: The
Here's my hypothetical example. I have a very simple WPF window with a one
I have a simple question, but don't seem to see the answer in a
Note: A have asked this question at the Superuser community first , but since
This question has been asked before (see here and here , for example). However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.