【发布时间】:2015-10-02 17:35:20
【问题描述】:
我在 ActionResult 中传递了两个列表变量,如下所示。
public ActionResult Index()
{
List<category> cat = _business.ViewAllcat().ToList();
List<Books> book = _business.ViewAllBooks().ToList();
return View(book);
}
当我运行代码时,出现以下错误
传入字典的模型项是类型 System.Collections.Generic.List1[Durgesh_Bhai.Models.category],但是 这个字典需要一个类型的模型项 System.Collections.Generic.IEnumerable1[Durgesh_Bhai.Models.Books]。
当我在 Actionresult 中只使用一个 List 时,它工作正常。
【问题讨论】:
-
我认为问题在于视图可以在这里发布您的索引视图
标签: c# .net asp.net-mvc