What is the Correct(TM) way to handle checkboxes with asp.net MVC and strongly typed views. I have a class 'Bar' that has a member 'foo'. 'foo' is type 'byte'.
Now what I would like do, is have something like this in controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Page( Bar bar )
{
if (ModelState.IsValid)
{
SaveChanges(bar);
...
And something like this in the view
<%=Html.CheckBox( "foo", Model.foo) %>
Of course the above code doesn't work, because DefaultModelBinder(?) doesn't know how to convert output from Checkbox (discussed here) to byte so ModelState.IsValid is false.
How to make it work? Custom Model Binders? How? Seems like a simple problem, but I've failed to find a comprehensive guide how to do this. (yes, I know I suck at googling :-)