我试图[HttpPost] Delete
从视图中调用。单击我想加载 jQuery 对话框并调用 post 操作方法。
它似乎在寻找我删除的删除视图。我只是保留 [HttpPost] 处理的代码。
索引视图
<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>
控制器
[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");
}
一旦我点击Delete
链接页面,就会自动重定向到Delete
没有 jQuery 对话框的视图。
网址是 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
如何直接调用删除帖子而不重定向?