我试图绑定剑道Grid.but它显示我以下错误剑道UI网格结合
传递到词典中的模型项的类型为“System.Data.Entity.DbSet
1[KendoApp.Product]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable
1 [KendoApp .Models.ProductModels]”。
我查看
@model IEnumerable<KendoApp.Models.ProductModels>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ProductID);
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice);
columns.Bound(p => p.UnitsInStock);
}).Pageable()
)
我的控制器
public ActionResult KendoGrid()
{
//IEnumerable<Product> products = new northwindEntities().Products;
var products = new northwindEntities().Products;
ViewBag.Products = products;
return View(products);
产品型号
public class ProductModels
{
public int ProductID { get; set; }
public string ProductName { get; set; }
public Nullable<int> SupplierID { get; set; }
public Nullable<int> CategoryID { get; set; }
public string QuantityPerUnit { get; set; }
public Nullable<decimal> UnitPrice { get; set; }
public Nullable<short> UnitsInStock { get; set; }
public Nullable<short> UnitsOnOrder { get; set; }
public Nullable<short> ReorderLevel { get; set; }
public bool Discontinued { get; set; }
}
}
什么错误?如何解决这个问题?