<td>
@Html.ActionLink("编辑", "Edit", new { id = 1 }) <text> |</text>
@Html.ActionLink("删除", "Delete", new { id = 2 })<text> |</text>
<a href="javascript:submitApp('id')" class="submitapp">提交</a><text> |</text>
@section Scripts {
<script>
function submitApp(appid) {
var choice = confirm("你确认提交吗?提交后将不可更改。");//确认框。
if (choice == true) {
$.post("/Sub/", { id: appid })
.success(function (data) {
alert("提交成功");
location.href = "/ApplicationProject/Index";
});
}
}
</script>
}
控制器的方法
[HttpPost]
public void Sub(string id)
{
var appProject = db.ApplicationProjects.Find(id);
appProject.IsSubmit = true;
db.SaveChanges();
// return RedirectToAction("Index");
}
标签:Index,Sub,示例,javascript,ActionLink,提交,id From: https://www.cnblogs.com/Biyuanguang/p/17094938.html