I am trying to call [HttpPost] Delete
from the view. on click I want load jQuery dialog and call post action method.
It seems it looking for Delete view which I deleted. I just kept the code for [HttpPost] to process.
index view
<ul class="dropdown-menu">
@{
@Html.TryPartial("_actions", model)
<li> @Html.ActionLink("Edit", "Edit", new {id =model.Id})</li>
<li class="divider"></li>
<li>@Html.ActionLink("Delete", "Delete", new {id =model.Id},new { @class = "delete-link" })</li>
}
</ul>
Controller
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteConfirmed(Byte[] id)
{
var committeeMember = db.Committee_Member.FirstOrDefault(x => x.Committee_Member_Id == id);
if (committeeMember != null)
{
committeeMember.Cancelled = 1;
db.Entry(committeeMember).State = EntityState.Modified;
db.SaveChanges();
Success("Your activity was deleted!");
return RedirectToAction("Index", new { id = committeeMember.Customer_Number });
}
Error("there were some errors in your form.");
return RedirectToAction("Index");
}
Once I click on the Delete
link page automatically redirecting to Delete
view without jQuery dialog.
url is http://company.com:55253/Member/Delete/AAAAAAICyns%3d
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Member/Delete/AAAAAAICyns=
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
How to call directly Delete post without redirect?