I need help displaying a label on my ASP.Net 3.5 application

Hi Experts,
I have an ASP.Net 3.5 application with VB.Net codebehind.  In my application I have a button that initiates some processing, and a label.  When the button gets pushed, it calls various functions.  I want the text of the label to change at the start of every function (sort of like a process status display).  I have written code to do this, but the text of the label only changes after all the processing is complete.  What can I do to fix this?

Thank you in advance,
mrotor Code for the label text
mainrotorAsked:
Who is Participating?
 
Jeff CertainCommented:
The problem is almost certainly that the page lifecycle is biting you. You likely need to move the processing to another thread (i.e. make it asynchronous) so that the button click returns immediately.

If you cut and paste the code, I can help you with this.

Are there any other requirements, such as changing the text back after the processing is complete?

0
 
Jeff CertainCommented:
Okay, I can see your code now (I'm on the road, with a very slow connection.)
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
mainrotorAuthor Commented:
Here is my code so you can just copy and paste it.
Protected Sub cmdFormat_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdFormat.Click

        lblError.Text = "Formatting report, please be patient..."

        Call ReportFirstSection()
	  lblError.Text = "First section completed..."

        Call ReportSecondSection()
	  lblError.Text = "Second section completed..."

        Call sL2_FormatReport()
        lblError.Text = "Excel formatting completed successfully"
    End Sub

Open in new window

0
 
mainrotorAuthor Commented:
Chaosian,
Yes, the text should display the following after the processing is complete:

lblError.Text = "Excel formatting completed successfully"
0
 
Jeff CertainCommented:
The basic solution is going to involve some form of AJAX. (AJAX is a technology that allows you to retrieve data from the server, and update part of a page rather than having to refresh the whole thing. It's the fundamental technology that allows websites to act like desktop apps from a user experience perspective.)

Here's a couple options that might help:
http://www.redips.net/javascript/ajax-progress-bar/
http://www.aspnettutorials.com/tutorials/themes/progress-bar-csharp.aspx

(The second one of these is loaded with advertising, but has the benefit of providing a link to a VB version at the bottom of the page.)
0
 
RickCommented:
You could try changing the text with javascript after you call each function.
0
 
Obadiah ChristopherCommented:
The problem I feel with Progress Bar in this situation is, he won't be able to display different messages for each funcs
0
 
mainrotorAuthor Commented:
rick_gwu,
How can I change the text with JavaScript, can you provide a sample?

mrotor
0
 
RickCommented:
There you go. Thanks CodeCruiser for providing the examples.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.