Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法将列表从视图中的viewmodel传递到局部视图_C#_Asp.net Mvc - Fatal编程技术网

C# 无法将列表从视图中的viewmodel传递到局部视图

C# 无法将列表从视图中的viewmodel传递到局部视图,c#,asp.net-mvc,C#,Asp.net Mvc,基本上我有一个视图模型 public class VM_MachineCheckSheet { public List<checksheet> checksheet; public List<MvcApplication2.Models.Machine.machine> machine; } 还有我的部分观点 @model IEnumerable&ltMvcApplication2.Models.Machine.machine&

基本上我有一个视图模型

public class VM_MachineCheckSheet
{        
    public List<checksheet> checksheet;
    public List<MvcApplication2.Models.Machine.machine> machine;
}

还有我的部分观点

@model IEnumerable&ltMvcApplication2.Models.Machine.machine&gt

<div id = "machine_filter" class = "machine_filter")
<table>
    <tr>
我不知道为什么部分视图中的机器列表和从视图模型传入的机器列表之间存在类型不匹配。它们是一样的。有什么想法吗?

你需要改变

@Html.RenderPartial("_MachineCheckBoxListPartial", Model.machine);


您正在接受
IEnumerable
,请尝试将其更改为
IList
,并且属性应为
公共IList检查表;公共IList机器非列表我将viewmodel中的计算机更改为IEnumerable,但不幸的是,它仍然给出相同的错误请检查发布的答案
Compiler Error Message: CS1502: The best overloaded method match for 
'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)
'has some invalid arguments

Line 7:  @Html.RenderPartial("_MachineCheckBoxListPartial", Model.machine);
@Html.RenderPartial("_MachineCheckBoxListPartial", Model.machine);
@{ Html.RenderPartial("_MachineCheckBoxListPartial", Model.machine); }