我需要根据两个键(comp和part)进行映射.
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.comp)
</td>
<td>
@Html.DisplayFor(modelItem => item.part)
</td>
...........................
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.comp }) |
@Html.ActionLink("Details", "Details", new { id = item.comp }) |
@Html.ActionLink("Delete", "Delete", new { id = item.comp })
</td>
</tr>
}
Run Code Online (Sandbox Code Playgroud)
如何在Index页面和控制器中使用复合键.
public ActionResult Edit(int? id)
{
DataView record = db.RecordDataView.Find(id);
if (record == null)
{
return HttpNotFound();
}
return View(record);
}
Run Code Online (Sandbox Code Playgroud)
如果有人有想法请回复.