views:

10

answers:

1

Hi,

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  A: 

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>
RedFilter
@Paul: thanks for the copy and paste fix
RedFilter