How do I use two foreach's on one table, or another method to get my count and total together?
This is the table:
<div style="padding-top: 30px">
<table id="table_id" class="display">
<thead>
<tr>
<th>Month</th>
<th>Count</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Date1.Reverse())
{
<tr>
<td> @Html.DisplayFor(modelItem => item.theDate) </td>
<td> @Html.DisplayFor(modelItem => item.theCount) </td>
</tr>
}
@foreach (var item in Model.Date2.Reverse())
{
<tr>
<td></td>
<td></td>
<td> @Html.DisplayFor(modelItem => item.theCount) </td>
</tr>
}
</tbody>
</table>
</div>
This is how I'm calling the models:
public class QueryView
{
public IEnumerable<Date1> Date1 { get; set; }
public IEnumerable<Date1> Date2 { get; set; }
}
}
@model CWebPortal.Models.QueryView
I want that Total to be on the same line of course.
Thanks!