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 7989289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:42:50+00:00 2026-06-04T12:42:50+00:00

In my C# ASP.NET project I’ve got a background thread that does some processing.

  • 0

In my C# ASP.NET project I’ve got a background thread that does some processing. I want to display to the user when the background process starts and when it ends. To that end, in the background code I’ve got:

public static void RefreshNavigationElements()
{
    TimeInfoEventArgs timeInformation = new TimeInfoEventArgs("WPALoading has started");
    WorkProductAgreements.OnSecondChange(timeInformation);
    WPA_Supers.Clear();
    PopulateWPAs();
    timeInformation.myMessage = "WPALoading has ended";

    WorkProductAgreements.OnSecondChange(timeInformation);
}

The code that’s listening to the event:

public void TimeHasChanged(TimeInfoEventArgs ti)
{
    Label11.Text = ti.myMessage;
    System.Diagnostics.Debug.WriteLine(ti.myMessage);
}

Stepping through things in the debugger shows that the TimeHasChanged function gets called at the appropriate times with the correct text inside of ti. The Debug.WriteLine command outputs the right message. But the Label11 text doesn’t change on the page.

In my not-very-deep understanding of things, I think I just need to trigger a refresh of the page, or something similar, but I can’t, for the life of me, figure out how to do that.

I’ve tried placing the Label inside an UpdatePanel. I’ve tried creating a new label each time TimeHasChanged gets called. But none of my attempts seem to make any difference. Any help would be greatly appreciated.

  • 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-06-04T12:42:52+00:00Added an answer on June 4, 2026 at 12:42 pm

    In ASP.NET, when a browser request a page, the server starts a thread to render the page and send it back to the browser. Once the page is rendered, the thread is finished, and all related background workers are also finished. The page is sent back to the browser as is at this point. So, unless you explicitly wait until the background worker finishes, it will never finish and update the page content.

    You can use some of the techniques here:

    • Asynchronous Pages in ASP.NET 2.0

    But, if your background worker takes quite a long time to execute, as the page won’t be sent to the browser until the thread finish, you can get timeouts or unresponsive pages in your browser.

    To avoid this you can use AJAX and web services: expose the functionality of the background worker in a web service method, and use AJAX to execute this method. Once this method has finished, you can update the labels directly in the browser. While this happens, the browser is still responsive.

    for this you can use jQuery and ASP.NEt web service, like explained here.

    Finally, you should never run a really long process in ASP.NET: the server recycles (restarts) the application from time to time, and this can stop the execution of you web service method abruptly.

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

Sidebar

Related Questions

I am doing asp.net project using C#.I want to display the contents that are
In my ASP.net project I need to validate some basic data types for user
I've got an ASP.net project with a folder containing some dll's. I have referenced
I have an ASP.Net project using AJAX that I am putting on a server
I have an ASP.NET project which has already some custom fields in it's web.config
I'm planning a new ASP.NET project that will become a product that is installed
I am developing an asp.net project that will be running in a lan. Every
I have a asp.net project, and in my design page I have some asp:Label
I have ASP.NET project which do some file access and manipulation, the methods which
I've inherited a asp.net project and I'm finding that the code behind pages contain

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.