【发布时间】:2014-01-27 05:04:04
【问题描述】:
我有一个 html 表格,我需要显示来自不同表格的不同数据。
这是桌子:
我在这里使用了viewmodel,我可以显示一些数据,但我需要显示所有内容。
如何显示 Delivery、Collection 和 Proposal 表中的数据?
这是我的视图模型:
public class FulfillmentViewModel
{
[Key]
public int ID { get; set; }
public IEnumerable<ULIV.Models.ProductModel> Product { get; set; }
public IEnumerable<ULIV.Models.ProposalModel> Proposal { get; set; }
public IEnumerable<ULIV.Models.PurchaseOrder> PurchaseOrder { get; set; }
public IEnumerable<ULIV.Models.Delivery> Delivery { get; set; }
public IEnumerable<ULIV.Models.Collection> Collection { get; set; }
public IEnumerable<Institution> Institution { get; set; }
}
这是我在 VIEW 上的代码:
<table class="table table-bordered table-hover">
<thead>
<tr class="th-center">
<th colspan="2">Product</th>
<th colspan="3">Purchase Order</th>
<th colspan="2">Delivery</th>
<th colspan="2">Collection</th>
<th rowspan="2">Action</th>
</tr>
<tr class="th-center">
<th>Name</th>
<th>Proposal Code</th>
<th>PO Number</th>
<th>PO Date</th>
<th>Received Date</th>
<th>SI Number</th>
<th>Delivery Date</th>
<th>OR Number</th>
<th>OR Date</th>
</tr>
</thead>
<tbody>
@foreach(var PO in Model.PurchaseOrder)
{
<tr>
<td>Anflu</td>
<td></td>
<td><a href="fulfillment–delivery-and-collection-details.html">@Html.DisplayFor(modelItem => PO.PurchaseOrderNo)</a></td>
<td>@Html.DisplayFor(modelItem => PO.PurchaseOrderDate)</td>
<td>@Html.DisplayFor(modelItem => PO.ReceivedDate)</td>
<td>SI-0002314</td>
<td>December 20, 2013</td>
<td>-</td>
<td>-</td>
<td class="text-center">
<a href="edit-purchase-order.html"><img src="Images/icon_edit.png" width="16" height="16"></a>
<a href="new-delivery.html"><img src="Images/icon-delivery.png" width="16" height="16"></a>
<a href="new-collection.html"><img src="Images/icon-collection.png" width="16" height="16"></a>
</td>
</tr>
}
</tbody>
</table>
【问题讨论】: