I am developing an MVC 5 web application. In one of my Razor views, I have a table that spits out several rows of data. Next to each row of data is the "Delete" button. When the user clicks the delete button, I want to get the Bootstrap Modal popup and ask the user to confirm their removal.
@foreach (var item in Model.Data) { <tr> <td>...</td> <td>@Html.ActionLink("Delete", "Delete", new { id = item.ID }, new { @class = "btn btn-danger btn-xs", data_toggle = "modal", data_target = "#myModal" })</td> </tr> }
As soon as the user clicks the โDeleteโ button, the modal pops up normally, but I canโt get the identifier in the Actionlink parameter to go to the โConfirmโ button in my module so that it is sent to the delete action in my controller.
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">Delete Nomination</h4> </div> <div class="modal-body"> Are you sure you wish to delete this nomination? </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button type="button" id="mySubmit" class="btn btn-primary">Confirm</button> </div> </div> </div> </div>
Can anybody help?
Thanks.
twitter-bootstrap asp.net-mvc bootstrap-modal
tgriffiths
source share