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

  • Home
  • SEARCH
  • 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 671703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:24:11+00:00 2026-05-14T00:24:11+00:00

I have an containing a list of divs that jQuery turns into progress bars.

  • 0

I have an containing a list of divs that jQuery turns into progress bars. On .ready, I build a list of all of these progress bars and for each one, call a webservice that gets a value indicating how full the progress bar should be. In order to do this, I need to pass the ID of the div to the web service.

Because the divs are inside a ListView, I manually set the id to be id=”completionbar_<%# Eval(“MilestoneID”) %>”

However, when I pass this id into my web service, it comes up as “undefined” every time. When I view the source, it looks like it’s set correctly.

Here’s the jQuery that calls my web service:

<script type="text/javascript" language="javascript">
$(document).ready(function() {
    $(".MilestoneCompletion").progressbar({ value: 0 });
    $.each($(".MilestoneCompletion"), function(index, barDiv) {
        $.ajax({
            type: "POST",
            url: "ProjectTracking.aspx/GetText",
            data: "{'id':'" + $(barDiv).id + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            async: true,
            success:
                function(msg) {
                    $(barDiv).progressbar("value", msg.d);
                }
        });
    });
});
</script>

Here’s the web service stub that doesn’t do anything right now:

[System.Web.Services.WebMethod]
public static int GetText(string id)
{
    return 75; // returns completion percent
}

Here’s where I’m setting the id of the div in the ListView:

<ItemTemplate>
<li class="ui-widget-content" >
...
<!-- when this div loads, I want to call my webservice -->
<div id="completionbar_<%# Eval("MilestoneID") %>" class="MilestoneCompletion" style="height:30px;"></div>
...
</li></ItemTemplate>

I’m thinking maybe the script is executing before the DIV id is set by the ListView databind?

Can I fix this, or is my approach fundamentally flawed?

  • 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-14T00:24:11+00:00Added an answer on May 14, 2026 at 12:24 am

    $(barDiv).attr('id')

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a list containing strings that look like this: 00x000s00g00wfds0d dkdf00sdf00sdfg00jk kf00dfjkd0sdl0sd0f0
I have a List containing HashMaps . Each HashMap in the list might have
I have an ItemsControl containing a list of data that I would like to
I have a CellTree containing a list of organisations. In the Model, each parent
I have a simple blog page - a list of posts that each consist
i have a file containing list paths and other related information of all the
I have a list containing objects of type numpy.ndarray, all list elements has same
I have a Dictionary containing 10 keys, each with a list containing up to
I have an array containing a list of file paths that I want to
I have a table containing a list of folders, each folder has an ID

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.