Update asp:Label on web page during for / next loop in code behind

Posted on 2007-08-06
Last Modified: 2013-11-07
During a for / next in the code behind, I want to update a label on the page with a counter, kind of like:

    Number of records processed: xx

Inside the loop i put a textbox1.text = counter, and counter is being incremented.  Nothing shows up on the page until AFTER the process is compelted.  BTW - i'm using

I feel stupid ... HELP!


Question by:timbersnow
    LVL 27

    Expert Comment

    you wont see it until the loop is done because your code is ran on the server
    if you want to see the label value increments you will need to use a client side javascript
    LVL 14

    Expert Comment

    what do you mean by  record processed ? What kind of process is that ?

    Author Comment

    i'm doing some geocoding (Lat/Long) on specific addresses.  For each address in the table (MSSQL), i do a address lookup and update that records Lat / Long, and then NEXT ...

    I want to show a counter and maybe a Processing Address: xxx, xxx on the page.

    LVL 2

    Accepted Solution

    Use Ajax.Net, It will help you get the desired result. Place your Label in <asp:UpdatePanel />.

    Go to for more information on using Ajax.Net

    Zeeshan Q. Ali
    Sr. Software Engineer, Folio3 Pvt. Ltd.,
    Karachi, Pakistan

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now