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 7760133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:48:10+00:00 2026-06-01T13:48:10+00:00

I have an Entity Framework generated table with values in a td that I

  • 0

I have an Entity Framework generated table with values in a td that I need to change. I need to do this on a row by row basis because I need to insert a group of radio buttons but each row of buttons needs a unique name.

Basically, I need to set the checked value for a group of buttons based on the value of the text in a td with id of “Rate”, and remove the existing text after I have got the value from it.

My Table looks like this,

<table id="IndexTable">
<tr>
    <th>CoffeeID </th>
    <th>Degree </th>
    <th>Weight </th>
    <th>Profile </th>
    <th>UsageInfo </th>
    <th>Comments </th>
    <th>AmbientTemp </th>
    <th>Rating </th>
    <th>WeightDeducted </th>
    <th>Selected </th>
    <th>ProfileID </th>
    <th>ProfileStart </th>
</tr>
<tr>
    <td>1 </td>
    <td>1 </td>
    <td>3 </td>
    <td>9 </td>
    <td>Filter Brew </td>
    <td>Perfecto!! </td>
    <td>55 </td>
    <td id="Rating">4.25 </td>
    <td>1 </td>
    <td>4 </td>
    <td>34 </td>
    <td>1 </td>

</tr>
<tr>
    <td>3 </td>
    <td>15 </td>
    <td>99 </td>
    <td>87 </td>
    <td>Espresso </td>
    <td>WTF </td>
    <td>99 </td>
    <td id="Rating">4.5 </td>
    <td>5 </td>
    <td>3 </td>
    <td>66 </td>
    <td>4 </td>

</tr>

And my script is as follows.

$("tr").each(function() { //get all rows in table
var str = $("text[id=Rating]").val(); //assign text with matching id to str ---doesn't work
$("td").each(function() { //get all tds in current row
    var newStr = ("#Rating").text; //assign text in td with id Rating to newStr ---- doesn't work
    alert(newStr); // fires undefined for each td in table? 
    //This is where I want to insert radio buttons and assign the one with the value of the Rating td to checked.
});
});

This is just the latest, I have looked all over this site, but everything I’ve seen doesn’t deal with getting the value from a specific column of a specific row, changing the value, and repeating for each row/column in the table.
I come from a db background, where this is really simple and this is very frustrating.

  • 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-06-01T13:48:11+00:00Added an answer on June 1, 2026 at 1:48 pm

    You’ve got a few things wrong with your html, and your jQuery, to start off, like SKS has stated, you cannot have multiple nodes in your html document that have the same ID. ID must be unique. I recommend using a class instead.

    You should also have your header row in a <thead> and the body of your table in a <tbody>

    now, onto your jQuery, $("td") will find all the td’s in the document, not just the ones in your row.

    you would want to use
    $(this).find('td') or you could use .children or a fancy higher level selector. There are MANY different, correct ways to get this information.

    I have taking your code and modified it like so:

    $("tbody").find("tr").each(function() { //get all rows in table
    
        var ratingTdText = $(this).find('td.Rating').text(); 
        //gets the text out of the rating td for this row
        alert(ratingTdText);
    
    });
    

    This works with the html slightly modified:

    <table id="IndexTable">
    <thead>
        <tr>
        <th>CoffeeID </th>
        <th>Degree </th>
        <th>Weight </th>
        <th>Profile </th>
        <th>UsageInfo </th>
        <th>Comments </th>
        <th>AmbientTemp </th>
        <th>Rating </th>
        <th>WeightDeducted </th>
        <th>Selected </th>
        <th>ProfileID </th>
        <th>ProfileStart </th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>1 </td>
        <td>1 </td>
        <td>3 </td>
        <td>9 </td>
        <td>Filter Brew </td>
        <td>Perfecto!! </td>
        <td>55 </td>
        <td class="Rating">4.25 </td>
        <td>1 </td>
        <td>4 </td>
        <td>34 </td>
        <td>1 </td>
    
    </tr>
    <tr>
        <td>3 </td>
        <td>15 </td>
        <td>99 </td>
        <td>87 </td>
        <td>Espresso </td>
        <td>WTF </td>
        <td>99 </td>
        <td class="Rating">4.5 </td>
        <td>5 </td>
        <td>3 </td>
        <td>66 </td>
        <td>4 </td>
    
    </tr>
    </tbody>
    </table>
    

    Hope this helps get you going in the right direction!

    oh, i almost forgot! here is a link to a jsfiddle so you can see this in action: http://jsfiddle.net/fCpc6/

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

Sidebar

Related Questions

Using the Entity Framework that I generated. I have a Roles table created during
I have an Entity in Code First Entity framework that currently looks like this:
In entity framework I have an Entity 'Client' that was generated from a database.
I have an Entity Framework POCO class that is generated by a T4 Template.
I have an Entity Framework model that was generated by the Visual Studio 2008
I'm using Entity Framework 4.1 Code First and I have a table that has
I have an XML document that I generate from an Entity Framework object. The
In Entity Framework 4.2 I have a Trips entity that can have 0..* PlacesOfInterest
I am using Linq and the Entity Framework. I have a Page Entity, that
I have created a Entity Framework 4 model with Visual Studio 2010 and generated

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.