0
我有這樣的看法:如何在asp.net mvc的標題顯示公司3
model IEnumerable<MvcApplication4.Models.Order>
@{
ViewBag.Title = "Index";
}
<h2>
顯示公司名稱
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th>
Customer
</th>
<th>
EmployeeID
</th>
<th>
OrderDate
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Customer.CompanyName)
</td>
<td>
@Html.DisplayFor(modelItem => item.EmployeeID)
</td>
<td>
@Html.DisplayFor(modelItem => item.OrderDate)
</td>
</tr>
}
</table>
我想顯示在我標誌着公司名稱膽大。目前它在foreach循環中顯示。不過,我希望這個視圖的一個字段能夠拉取CompanyName並將其顯示在我的標題之間。
我試過這個,但它給我一個編譯錯誤。 – Sithelo