【发布时间】:2018-01-17 14:33:41
【问题描述】:
我正在使用带有实体框架的 ASP.NET MVC 5。
目前我有一个侧面有按钮的桌子:
<table class="table">
<tr>
<th>
@Html.ActionLink("Name", "DisplayAllAdmin", new { sortOrder = ViewBag.NameSortParm }, htmlAttributes: new { @class = "sortLabel" })
</th>
<th>
@Html.DisplayNameFor(model => model.Description)
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
<a href="@Url.Action("Download", "Sth", new { id = item.Id }, null)"><i class="material-icons">get_app</i></a>
<a href="@Url.Action("Delete", "Sth", new { id = item.Id }, null)"><i class="material-icons">delete</i></a>
</td>
</tr>
如何添加下一步按钮来显示记录详情?
现在我有这样的东西:
<tr style="display:none">
<td>@Html.DisplayFor(modelItem => item.TbVersion)</td>
</tr>
<script type="text/javascript" language="javascript">
function DisplayDetails(id)
{
if (document.getElementById("detailsField").style.display == "none")
{
document.getElementById("detailsField").style.display = "block";
}
else
{
document.getElementById("detailsField").style.display = "none"
}
}
</script>
<button onclick="DisplayDetails(id)"><i class="material-icons">info</i></button>
但是我在传递 ID 时遇到了麻烦。有什么建议么?非常感谢。
【问题讨论】:
-
你有什么错误吗?
-
查看引导折叠。 getbootstrap.com/docs/4.0/components/collapse 。这将允许您通过单击按钮来隐藏/显示记录。
标签: javascript c# entity-framework asp.net-mvc-5