Asp.net mvc 4 ASP.NET MVC4:单击“编辑”、“详细信息”或“删除”链接时,如何高亮显示所选行并发送控制器对应的id
我需要帮助。我正在使用ASP.NETMVC4。我有一个视图(Index.cshtml),它使用实体框架显示sql数据库表中的数据。我想知道如何高亮显示所选行,并将特定id(id\U设备)发送到一个html.actionlink以编辑、删除或查看详细信息。 以下是我的看法:Asp.net mvc 4 ASP.NET MVC4:单击“编辑”、“详细信息”或“删除”链接时,如何高亮显示所选行并发送控制器对应的id,asp.net-mvc-4,Asp.net Mvc 4,我需要帮助。我正在使用ASP.NETMVC4。我有一个视图(Index.cshtml),它使用实体框架显示sql数据库表中的数据。我想知道如何高亮显示所选行,并将特定id(id\U设备)发送到一个html.actionlink以编辑、删除或查看详细信息。 以下是我的看法: @model IEnumerable<TEST.Models.equipment> @{ ViewBag.Title = "Index"; } <h2>Index</h2> &
@model IEnumerable<TEST.Models.equipment>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
@Html.ActionLink("Edit", "Edit", new { id = /*item.id_equipment*/ }) |
@Html.ActionLink("Details", "Details", new { id = /*item.id_equipment*/ }) |
@Html.ActionLink("Delete", "Delete", new { id = /*item.id_equipment*/ })
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.id_equipment)
</th>
<th>
@Html.DisplayNameFor(model => model.name)
</th>
<th>
@Html.DisplayNameFor(model => model.type)
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.id_equipment)
</td>
<td>
@Html.DisplayFor(modelItem => item.name)
</td>
<td>
@Html.DisplayFor(modelItem => item.type)
</td>
</tr>
}
</table>
@model IEnumerable
@{
ViewBag.Title=“Index”;
}
指数
@ActionLink(“新建”、“创建”)
@ActionLink(“编辑”,“编辑”,新的{id=/*item.id\u设备*/})|
@ActionLink(“详细信息”,“详细信息”,新的{id=/*item.id\u设备*/})|
@ActionLink(“删除”,“删除”,新的{id=/*item.id\u设备*/})
@DisplayNameFor(model=>model.id\u设备)
@DisplayNameFor(model=>model.name)
@DisplayNameFor(model=>model.type)
@foreach(模型中的var项目){
@DisplayFor(modeleItem=>item.id\u设备)
@DisplayFor(modelItem=>item.name)
@DisplayFor(modelItem=>item.type)
}
谢谢大家! 您是否考虑过添加一个带有CRUD的控制器,这将生成带有附加ID的ActionLinks的所有视图以进行编辑、删除、详细信息等?您是否考虑过添加带有CRUD的控制器,这将生成带有附加ID的ActionLinks以进行编辑、删除、详细信息等的所有视图?