我有这样的看法:
@model IEnumerable<sn.Models.Order>
<h2>
**Name of Recipients**
</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th>
Last Name
</th>
<th>
Mark
</th>
<th>
Quiz Number
</th>
<th>
Pass
</th>
<th>
Paid
</th>
<th>
Mark Date
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Customer.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Mark)
</td>
<td>
@Html.DisplayFor(modelItem => item.QuizNo)
</td>
<td>
@Html.DisplayFor(modelItem => item.Pass)
</td>
<td>
@Html.DisplayFor(modelItem => item.Paid)
</td>
<td>
@Html.DisplayFor(modelItem => item.MarkDate)
</td>
</tr>
}
</table>
下面是一张显示我的观点的图片:
我想显示 LastName 代替Name of Recipients。对于特定客户,LastName 项目不会更改。此视图显示该用户的详细信息,这是我用来在控制器中获取结果的代码的一部分:
var certificateDetails = db.orders.Where(p => p.ID == id);
return View( certificateDetails.ToPagedList(pageNumber, pageSize));