如果选中复选框,如何在控制器中更新方法?见下图 http://i.stack.imgur.com/5RmbK.jpg
>[HttpPost]
>public ActionResult Update(int id)
>{
> //code update status in db
> }
答案 0 :(得分:4)
试试这个(Razor语法):
//for a checkbox
@Html.CheckBox("chkName",false, new {onclick="this.form.submit();"})
//if using strongly typed model property
@Html.CheckBoxFor(model=> model.chkName, new {onclick="this.form.submit();"})