我正在实施一个动作链接来执行删除。最初是使用javascript确认框。由于客户要求更改确认框标题文本,我需要使用jquery确认对话框。单击链接时,它将直接执行删除而不提示对话框。请帮我。谢谢!
我的观点& ActionLink的:
@Html.ActionLink("Remove", "SURV_Admin_Group_Delete", "SURV_Admin", new { id = Model[i].GroupID }, new { @class = "modal" })
<div id="dialog-confirm"></div>
Jquery对话框脚本:
$('.modal').click(fnOpenNormalDialog);
function fnOpenNormalDialog() {
$("#dialog-confirm").html("Confirm Dialog Box");
// Define the Dialog and its properties.
$("#dialog-confirm").dialog({
resizable: false,
title: "Modal",
height: 250,
width: 400,
buttons: {
"Yes": function () {
return true;
},
"No": function () {
return false;
}
}
});
}
我的删除控制器:
public ActionResult SURV_Admin_Group_Delete(int id)
{
SURV_Group_Model surv_group_model = db.SURV_Group_Model.Find(id);
db.SURV_Group_Model.Remove(surv_group_model);
db.SaveChanges();
return RedirectToAction("SURV_Admin_Create_Group");
}