我工作的一个ASP.NET MVC应用5。我需要在局部视图中创建表单。在这个表格中,我传递了ViewModel
,它们包含所有相关的模型类实例。现在是模型类之一,我需要传递数据列表,以便我可以在foreach循环中使用剃须刀代码进行打印。传递模型和modellist数据一起的局部视图 - ASP.NET MVC 5
现在我需要的是通过几个类和一个模型来查看列表数据的模型......
非常感谢
视图模型:
public class QualificationViewModel : LEO.DAL.ViewModels.IQualificationViewModel
{
public Qualification _Qualification { get; set; }
public QualificationType _QualificationType { get; set; }
public Subject _Subject { get; set; }
public ComponentScheme _ComponentScheme { get; set; }
}
控制器:
[HttpGet]
public ActionResult CreateNewQualification()
{
var model = new QualificationViewModel();
var ComponentList = //imagin this is list of components that i need to send along with viewModel ??????????????????????
return PartialView("PartialQualification_Create", model);
}
查看(需要更正此部分(此处显示清单数据)
@model LEO.DAL.ViewModels.QualificationViewModel
@*<div class="_FormGrid_block_1">
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model._ComponentScheme.ComponentTitle)
</th>
<th>head1</th>
</tr>
@foreach (var item in Model._ComponentScheme)
{
<tr>
<td>
@Html.DisplayFor(modelItem => modelItem._ComponentScheme.ComponentTitle)
</td>
<td>
aaaaaaaaaaaaaa
</td>
</tr>
}
</table>
</div>*@
什么是你的问题? –
如果我理解corectly你想发送一个对象列表类型'QualificationViewModel'到模型? –
与ComponentScheme – toxic