I have a table in MVC view that displays employee details. I'd like to add an edit functionality, but instead of opening it in a new page, I'd like to show it using a bootstrap modal. (http://twitter.github.com/bootstrap/javascript.html#modals)
I don't think I have to use ajax since the data is already available on the page. I think I need to some jquery or razor code to pass the selected employee's data to the bootstrap modal, and pop it up on the same screen. Below is my code. Any help would be greatly appreciated. Thanks
@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>