我使用該
'PaginatedList<CustomerInventoryCollectionDataModel>' does not contain a definition for 'Inventorys' and no accessible extension method 'Inventorys' accepting a first argument of type 'PaginatedList<CustomerInventoryCollectionDataModel>' could be found (are you missing a using directive or an assembly reference?)
PaginatedList<CustomerInventoryCollectionDataModel>' does not contain a definition for 'CustomerData' and no accessible extension method 'CustomerData' accepting a first argument of type 'PaginatedList<CustomerInventoryCollectionDataModel>' could be found (are you missing a using directive or an assembly reference?)
如何按照鏈接中的建議對 Inventorys 表進行分頁
uj5u.com熱心網友回復:
在您的 View 中,您定義PaginatedList為您的 View 模型,并且它沒有任何帶有 nameCustomerData或Inventorys.
您可以像這樣更改代碼:
public class CustomerInventoryCollectionDataModel
{
public Customer CustomerData { get; set; }
public PaginatedList<Inventory> Inventorys { get; set; }
}
和
@model JAXApp.Models.CustomerInventoryCollectionDataModel
<div>
<h4>Customer</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
Customer Number
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.CustomerData.CustomerNumber)
</dd>
</d1>
<table class="table">
<thead>...</thead>
<tbody>
@foreach (var item in Model.Inventorys)
{
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/327538.html
標籤:asp.net asp.net-mvc 实体框架 asp.net核心 实体框架核心
上一篇:在C 中決議輸入以進行競爭性編程
