2

I have a view in ASP.NET MVC. It takes the model object and iterates over a list of strings and displays them in a table row, like so:

Details

<table>
<tbody>
    <tr>
        <th>Values in the database</th>
    </tr>

<% foreach (string value in Model.lstDistinctValues)
   {%>
   <tr>

   <%=value%>
   <%} %>
   </tr>
</tbody>

The problem is that the values appear ABOVE the header. So 'Values in the database' appears at the bottom, while the values are at the top.

Why would this be happening?

1 Answer 1

1

You need to add TD elements.

<table>
<tbody>
    <tr>
        <th>Values in the database</th>
    </tr>

<% foreach (string value in Model.lstDistinctValues)
   {%>
   <tr>
        <td><%=value%></td>
   </tr>
   <%} %>
</tbody>
</table>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.