@HTML.checkboxFor()用法

<%=Html.CheckBox("chk1",true) %> 
<%=Html.CheckBox("chk1", new { @class="checkBox"}) %> 
<%=Html.CheckBoxFor(a =>a.IsVaild, new { @class = "checkBox" })%>
 
生成结果:
 
<input checked="checked" id="chk1" name="chk1" type="checkbox" value="true" /><input name="chk1" type="hidden" value="false" />
 
<input class="checkBox" id="chk1" name="chk1" type="checkbox" value="true" /><input name="chk1" type="hidden" value="false" />
 
<input checked="checked" class="checkBox" id="IsVaild" name="IsVaild" type="checkbox" value="true" /><input name="IsVaild" type="hidden" value="false" />
文章来自:http://www.cnblogs.com/renshen555/p/4218079.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3