Below is my table in the View and controller, not sure why it gives an empty error on the last column at the mainId.
This is my table in the view:
@model IEnumerable<ListViewModel>
<table class="table table-bordered table-striped">
<thead class="thead-dark text-white">
<tr>
<th>id</th>
<th>Created By</th>
<th>Date</th>
<th>More detail ...</th>
</tr>
</thead>
<tbody>
@foreach (var item in @Model)
{
<tr class="table-primary">
<td>@item.tbl_saved.rowid </td>
<td>@item.tbl_main.user_logged_in</td>
<td>@item.tbl_saved.date_created</td>
<td>@Html.ActionLink(item.tbl_main.user_logged_in, "Details", "Home", new { mainId = item.tbl_main.Id }, null)</td>
</tr>
}
</tbody>
</table>
Controller for this table:
var query = from pd in _context.tbl_main
join p in _context.tbl_saved on pd.Id equals p.mainId
orderby p.rowid
select new ListViewModel { tbl_main = pd, tbl_saved = p };
return View(query);
The table loads fine when I comment this out:
<td>@Html.ActionLink(item.tbl_main.user_logged_in, "Details", "Home", new { mainId = item.tbl_main.Id }, null)</td>
But I want this to navigate to the details obviously.