I am running a C# Web App that is in a for loop performing some work. The code is running on the server. I added the following code to try to display a running count to the user. I only want the count to update every 100 cycles.
// display running count to user
msgCnt += 1;
if ((msgCnt % 100) == 0) lblCount.Text = "Count: " + msgCnt;
The count does not display until the loop ends and the page gets posted back to the browser. It may be several minutes until the loop finishes and I need to keep the user updated on the progress.
How can I display the count in a label while the loop is running???
-----------------------------------------------------------------------
I looked into Client-Callback but I only found examples where a user has to click a button.
Help with c# script
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Ryan AlfordRank #1,411 · 1.2K reputationPosted Jun 4, 2008, 11:07 AM EDT
to do this, you would probably need to do some javascript and have it update the counter.
you could probably do a search for "asp.net javascript counter" and find some good examples.
Robert3 reputationPosted Jun 5, 2008, 5:39 AM EDT