我在 MVC 视图中有一个显示员工详细信息的表。我想添加一个编辑功能,但我不想在新页面中打开它,而是想使用引导模式显示它。(http://twitter.github.com/bootstrap/javascript.html#modals)
我认为我不必使用 ajax,因为数据已经在页面上可用。我想我需要一些 jquery 或 razor 代码将所选员工的数据传递给引导模式,并在同一屏幕上弹出它。下面是我的代码。任何帮助将不胜感激。谢谢
@Foreach(var item in Model.Employees)
{
<tr>
<td>@User.Identity.Name
</td>
<td>@item.FirstName
</td>....other columns
<td><a href="#myModal" role="button" class="btn" data-toggle="modal">Edit</a>
<td>
</tr>........other rows
}
**Bootstrap Modal**
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Edit Employee</h3>
</div>
<div class="modal-body">
<p>Selected Employee details go here with textbox, dropdown, etc...</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>