开发者

Checkbox doesn't render

This is what I did on the view. I put @Html.CheckBox("checkBox", false, "Name") in a jQuery UI tab.

But on the rendered html, this checkbox control was evaluated as a html string

<input 开发者_如何学运维id="checkBox" name="checkBox" type="checkbox" value="true" /><input name="checkBox" type="hidden" value="false" /><label for="checkBox">Name</label> 

rather than a control. Any idea?


The default for Html.CheckBox also creates a hidden input tag.

This will return the value you get when the checkbox is not checked. Due to the nature of html, if a checkbox is not checked, nothing will be posted. So this is the easiest workaround.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜