Display a byte as a checkbox using a EditorTemplate?
问题 My model class: public class StatusList { public int StatusID {get;set;} [UIHint("ByteCheckbox")] public byte Active {get;set;} } In /Views/Shared/EditorTemplates I created a file called ByteCheckbox.cshtml The editortemplate ByteCheckbox contains (My 3rd attempt): @model byte @if (Model == 1) { @Html.CheckBox("", true) } else { @Html.CheckBox("", false) } Doing this nicely renders a checkbox. When I change the checkbox status and try to save the changes the model validation complains that