我正在寻找在ASP.NET MVC中实现模态对话框的最标准方法.
我想要做的一个例子就是当我从"列表"页面中选择一个项目时,我希望"详细信息"页面是列表上的弹出窗口而不是新页面.我不是在寻找黑客.我希望它是一个遵循ASP.NET MVC模式的解决方案.我也不希望不使用jQuery和ASP.NET Ajax(没有插件,除非它作为最佳实践出现).
<table>
<tr>
<th>
Author
</th>
<th>
Title
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Author)
</td>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
@Ajax.ActionLink("View Reviews", "View", new { id = item.ID }, new AjaxOptions { UpdateTargetId = "result", InsertionMode = InsertionMode.InsertAfter })
</td>
</tr>
}
</table>
<div id="result">
</div>
public PartialViewResult View(int id)
{
ReviewModel …
Run Code Online (Sandbox Code Playgroud)