Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi all,

I have a web application in ASP.net 2.0 (using Ajax), and I'm stuck with a problem.
I have an button click event, that is taking about 60/70seconds, and I added a Ajax UpdateProgress with a animated gif, but I would like to have a Label/text panel, to show what requeste is being made.

Imagine that after button click I have some functions running, and I want to show what function is running and the status on the fly.

Example:
some pseudo-code:
C#
button click
{
showmessage(Function 1............... Loading)
Function1()
showmessage(Function 1............... Done)
showmessage(Function 2............... Loading)
Function2()
showmessage(Function 2............... Done)
showmessage(Function 3............... Loading)
Function3()
showmessage(Function 3............... Done)
showmessage(All Done)
}



in the screen it will appear step-by-step, no only at the end of the click event

Function 1............... Loading
Function 1............... Done
showmessage(Function 2............... Loading)


Any help?tips?
Thank you
Posted
Updated 17-Mar-11 8:09am
v3

1 solution

Help!. This is possible in a dirty way, but if you ask my opinion it is not a good idea. Actually you are degrading the performance by increasing the chatty between client and server. You wont find difference with one client, but if 1000s access your site, this chat gives significant performance issue in the server. Some sites offer this kind of fancy stuff where they would have efficient server on the other side.

Now the way is your process has to update progress/ status to session specific variable. You need to run a ajax enabled javascript function at desired intervals using javascript's SetInterval method. The page called by the ajax script read the session variable and return to the client.

Note for this the heavy process has to be invoked using ajax calls. Form posting won't work for keeping the client active.
 
Share this answer
 
v2
Comments
Espen Harlinn 18-Mar-11 5:25am    
Good thinking, my 5
Albin Abel 18-Mar-11 5:46am    
Thanks Espen Harlinn
soflp-pt 18-Mar-11 13:41pm    
Thank you for the info, but, is there any example with the status info being updated?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900