Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:18:20+00:00 2026-05-13T06:18:20+00:00

I have a loop on the server ( C# ) that does this: for(i=0;i<=Request.Files.Count

  • 0

I have a loop on the server ( C# ) that does this:

for(i=0;i<=Request.Files.Count - 1; i++)
{
   // tell the client that the upload is about to happen
   // and report useful information
   Update(percent, message, i, 0);

   System.Threading.Thread.Sleep(1000);

   // tell the client that upload succeeded
   // and report useful information
   Update(percent, message, i, 1);

}

The function “Update” writes to the client-side javascript function “PublishUpdate”.
The row parameter is the row in the table containing the uploading file. The ‘status’ tells us if the file is about to be uploaded (0) or completed (1).

THE PROBLEM is that I can’t seem to get the count correct. The loop seems to
start 2 or 3 rows into the table or (after playing with the row value) it ends before the
final row. I am very new to jQuery. Does anything look obviously wrong to you?

    function PublishUpdate(percent, message, row, status) 
    {
       var bodyRows = $("#picTableDisplay tbody tr");

           bodyRows.each(function(index){
               if (index == row && status == 0)                
                $('#status'+index).html("<img alt='inproc' src='images/loading.gif' />");
               else if (index == row && status == 1)
                $('#status'+index).html("complete");

    });

}

Finally, the table looks like this:

<table width="100%" cellspacing="0" cellpadding="3" border="0" align="center" id="picTableDisplay" summary="" class="x-pinfo-table">
                        <tbody id="files_list" class="scrollContent">
                            <tr class="evenRow">
                                <td class="numCol" id="num0">
                                </td>
                                <td class="fnameCol" id="fname0">
                                </td>
                                <td class="statusCol" nowrap="" id="status0">
                                </td>
                                <td class="remCol" id="rem0">
                                </td>
                            </tr>
                            <tr class="oddRow">
                                <td class="numCol" id="num1">
                                </td>
                                <td class="fnameCol" id="fname1">
                                </td>
                                <td class="statusCol" nowrap="" id="status1">
                                </td>
                                <td class="remCol" id="rem1">
                                </td>
                            </tr>
                            <tr class="evenRow">
                                <td class="numCol" id="num2">
                                </td>
                                <td class="fnameCol" id="fname2">
                                </td>
                                <td class="statusCol" nowrap="" id="status2">
                                </td>
                                <td class="remCol" id="rem2">
                                </td>
                            </tr>
                            AND SO ON ...

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:18:21+00:00Added an answer on May 13, 2026 at 6:18 am

    The C# is using zero indexing, and typically HTML authors use indexing starting from one. Check to see if you need to correct the index from 0 to 1-based, like this:

    $('#status' + (index + 1))
    

    Also refactoring your code to something simpler can often fix hidden errors, or at least make the error more obvious. I’d suggest something along these lines:

    if (index == row)
    {
        if (status == 0) {
            html = "<img alt='inproc' src='images/loading.gif' />";
        } else {
            html = "complete";
        }
        $('#status'+index).html(html);
    }
    

    You should also use C# idiom for looping, < x not <= x - 1:

    for(i=0; i < Request.Files.Count; i++)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 290k
  • Answers 290k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I took a look at this problem a while back… May 13, 2026 at 5:50 pm
  • Editorial Team
    Editorial Team added an answer Please note the following: I've assumed that there is a… May 13, 2026 at 5:50 pm
  • Editorial Team
    Editorial Team added an answer I think it's as simple as this: $(thumbs).click(function() { var… May 13, 2026 at 5:50 pm

Related Questions

I have an application that I have written for my application distributed throughout the
Background Currently I have a C# Silverlight business application which uses RIA Services. The
and thanks for taking a look at the question. The background I have several
Environment I'm working on a C++ application that uses SQL Native Client 9.0 to
.NET 3.5, C# I have a web app with a search feature. Some of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.