My Controller:
[HttpPost]
public ActionResult DeleteStudent(int id)
{
Student s = db.Students.Include("Cla").Include("Section").Where(e => e.Id ==
id).SingleOrDefault();
db.Students.Remove(s);
db.SaveChanges();
return RedirectToAction("AllStudent", "Admin");
}
My View:
@model PagedList.IPagedList<TakGayeYArHumB.Models.Student>
@using PagedList.Mvc;
<table class="table table-bordered">
<tr>
<th>Options</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
<div class="btn-group">
<button type="button" class="btn btn-
primary dropdown-toggle" data-toggle="dropdown">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li>@Html.ActionLink("Edit", "UpdateStudent", new { id = item.Id })</li>
<li>@Html.ActionLink("Delete", "DeleteStudent", new { @id = "form-message-delete" })</li>
</ul>
</div>
</td>
</tr>
}
</table>
function messageDelete(index) {
bootbox.dialog({
message: "Are you sure you want to delete the message ?",
title: "Delete Message Confirmation",
buttons: {
success: {
label: "Continue",
className: "btn-success",
callback: function deletemember() {
$('.messageId').val(index);
$('#form-message-delete').submit();
},
danger: {
label: "Cancel",
className: "btn-danger",
callback: function () {
bootbox.hideAll();
}
}
}
}
});
};
What I have tried:
I'm trying to show a pop up When i click on a Delete Link. But it is not working. Can anyone solve this problem.Although it delete data correctly but not showing pop up.