Can somebody look at the below code and tell me what I am doing wrong. 

```
for(i=0;i<=Request.Files.Count;i++)
{

int percentComplete = (int)Math.Ceiling((double)(i + 1) / (double)Request.Files.Count * 100);
string message = string.Format("{0} of {1} uploaded", i + 1, Request.Files.Count);

ScriptManager.RegisterStartupScript(this, this.GetType(), "progress", @"do_progress("+message+","+percentComplete+");", true);

}

```

I am trying to update the client with each pass of the loop. On the client (inside of the form tags) I have a function called "do\_progress" that takes two parameters: message and percent. My intention is that the client-side method fires with each pass of the loop but nothing happens. 

**UPDATE**

Thanks for your help. Ramiz, your code won't work in my case because it collects all the methods (and progress) inside the loop and then sends them to the client at the same time.
This won't show progress accurately (each loop represents the completion of an uploaded file). I need to be accessing the client function, do\_progress, after each unique completion of the server-side loop. 

Also, the page has already loaded and the code is fired when a (upload) button is clicked. 

Having said that, I am still having problems. I can confirm that I am getting the results I want with the below code by looking at 'selection source':

```
int percentComplete = (int)Math.Ceiling((double)(i + 1) / (double)Request.Files.Count * 100);

string message = string.Format("{0} of {1} uploaded", i + 1, Request.Files.Count);

ScriptManager.RegisterStartupScript(this, this.GetType(), "progress" + i, @"do_progress('" + message + "','" + percentComplete + "');", true);

```

But, I am not seeing the results update in real-time on the client. The progress bar isn't moving and the counter (n of n files) isn't doing anything. But, when I look at the innerHTML, the values have updated. Very odd. It is almost like I need to be refreshing the page or something but that should't be necessary. 

The client side function I am using, which is placed in the form tags at the end of the page, looks like this: 

```
function do_progress(message,percent)
                    {
                        try {
                            $('progress_status').innerHTML = message;
                            $('progress_bar').attr("style", percent + "px"); 
                        }catch(e){alert(e.message)};
                    }   

```