我的检查箱正在更新b,但在复读“检查”价值时没有。
<input type="checkbox" id="chkPriorityOnly" @if(Model.PriorityOnly){<text> checked="checked" </text>}/> Priority Only <br />
然后,我按照建议使用:
@Html.CheckBoxFor(model => Model.PriorityOnly, new { id = "chkPriorityOnly" }) Priority Only<br />
而这是我在拯救选择时的:
<input id="chkPriorityOnly" name="PriorityOnly" type="checkbox" value="true" /><input name="PriorityOnly" type="hidden" value="false" /> Priority Only<br />
在这里,我可以放心:
function OnRestrictionsSaveClick() {
$.ajax({
type: POST ,
url: @Url.Content("~/Audience/UpdateRestrictions?audienceID=" + Model.AudienceID)
+ &priorityOnly= + $( #chkPriorityOnly:checked ).val()
+ &home= + $( #chkHome:checked ).val()
+ &work= + $( #chkWork:checked ).val()
+ &cell= + $( #chkCell:checked ).val()
+ &text= + $( #chkText:checked ).val()
+ &other= + $( #chkOther:checked ).val() ,
success: function (data) {SaveRestrictionsResponse(data); }
});
}