//In a "Viev" I already have a model called, example, in a examplePage.cshtml
@model ProjectExample.Models.Table1
@{
ViewBag.Title = "ExamplePage";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
@Html.LabelFor(model => model.Field1)
}
//I need to pull data from another tablord to list it.
//I want to draw data in Table2, what should I do?
//I was try IEnumerable< ProjectExample.Models.Table2>
@model IEnumerable< ProjectExample.Models.Table2>
foreach(var item in Model)
{
@Html.LabelFor(model => model.Field1)
}
但是当我这样做时,上面的表1的数据不起作用 我需要从另一个tablord中提取数据来列出它 我想在表2中绘制数据,我该怎么办? 我试过IEnumerable&lt; ProjectExample.Models.Table2&GT;