@if (ViewData["post"] != null)
{
foreach (var item in ViewData["post"] as IEnumerable<Employee.Models.ApplyJob>)
{
<tr>
<td>@item.PerferenceNo</td>
<td>@item.JobName</td>
<td>@item.Location</td>
<td>Action</td>
</tr>
}
}
how to use row span on PerferenceNo and JobName using MVC4>
You need to compare the previous values with the current values, but there is no need to use
rowspan
(which would unnecessarily complicate it). You can just generate an empty<td>
element when the cell matches the previous value.And I strongly recommend you pass a model to the view, rather than casting it from
ViewData
If you do want to use the
rowspan
attribute, then you code will need to beBut you really should be using view model in that case with properties for the rowspan values and run your queries in the controller.