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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:41:41+00:00 2026-06-04T07:41:41+00:00

I am attempting to make an HTML Table with data I pull out of

  • 0

I am attempting to make an HTML Table with data I pull out of DB…

Here is my Model…

public class PopulationModels
{
    public List<PopulationModel> Populations { set; get; }
}

Which is simply a list of…

public class PopulationModel
{
    public string populationID { set; get; }

    public string PopName { set; get; }

    public string Description { set; get; }

    public string PopulationType { set; get; }

    public Boolean isActive { set; get; }

    //public List<XSLTACOData> patients { set; get; }
}

I pass this model to my view like so…

IEnumerable<PopulationModels> PopModel = DataRepo.Get(userName);
return View(PopModel);

I attempt to show a list in the following way…

@foreach (var item in Model) {
<tr>
    <td class="rowControl hidden">
        @*<a href="#makeRowEditable" class="makeRowEditable">Edit</a>*@ |
        @*<a href="#deleteRow" class="deleteRow">Delete</a>*@
        @Html.DispalyFor(modelItem => item.Populations)
    </td>
</tr>
}

But I am having a hard time figuring out how to access the individual elements of my model…

For instance

@Html.DispalyFor(modelItem => item.Populations)

The above line of code, I want to take each individual populationModel and map a column for each of the fields… But I can’t seem to access the individual populations… Am I missing a logical step here (I obviously am, but which step?)

UPDATE: ADDING SOME MORE OF THE VIEW: I am making now getting a table, but the way I am doing it seems counter intuitive…

Here is my model…

 @model IEnumerable<FocusedReadMissionsRedux.Models.PopulationModels>

Here is how I am creating my table (I am planning on using jqGrid’s tableToGrid functionality as soon as I can get a solid way to access my data…

<table border="2">
<thead>
  <tr>
  <th>
    Population Name
  </th>
   <th>
    Population Description
  </th>
  </tr>
</thead>
@foreach(var item in Model){
foreach (var pop in item.Populations)
{
<tr>
    <td class="rowControl hidden">
        @Html.DisplayFor(modelItem => pop.PopName)
        @Html.ActionLink(pop.PopName,"","")
    </td>
    <td>
        @Html.DisplayFor(modelItem => pop.Description)
        @Html.Display(pop.Description)
    </td>
</tr>
}

}

  • 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-04T07:41:41+00:00Added an answer on June 4, 2026 at 7:41 am

    Since you didn’t post the complete code for your view: you should define what kind of object you are binding to in your view like this:

    @model IEnumerable<PopulationModels>
    

    Then you can just loop through it with a foreach and bind to the current item using:

    @Html.DisplayFor(x => x.Popname)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to make the buttons stretched out to make a uniform list but
You can see my project here - http://www.inluxphoto.com/custom/jsgallery/index.php I am attempting to make the
I'm attempting to make a table that has header rows that can be collapsed
I'm attempting to make a PDF from a HTML document, and this document has
I am attempting to remove a class from an html tag using JavaScript but
I'm attempting to make a ticket system for out smaller company. I've made a
I am attempting to parse HTML for specific data but am having issues with
Attempting to make a NSObject called 'Person' that will hold the login details for
I'm attempting to make a StateMachine execute some database action between states. So I
I am attempting to make a program in C which presents a GUI and

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.