HTML - 表单
元素
checkbox
<form action="/User/GetData" method="post"> <div> <input type="checkbox" name="the" checked/> <input type="checkbox" name="the2" /> <input type="checkbox" name="the3" value="true" checked/> <input type="checkbox" name="the4" value="true"/> <input type="checkbox" name="the5" checked/> <input type="checkbox" name="the6" /> <input type="checkbox" name="the7" value="true" checked/> <input type="checkbox" name="the8" value="true"/> <input type="submit" value="sub" /> </div> </form>
[HttpPost] public JsonResult GetData(bool? the, bool? the2, bool? the3, bool? the4, string the5, string the6, string the7, string the8) { /* the = null; the2 = null the3 = true; the4 = null; the5 = "on" the6 = null; the7 = "true"; the8 = null; */ return Json(null); }