views:

610

answers:

1

i have my checkbox for a bool field like so in my view:

=Html.CheckBox("Active", ViewData["Active"] != null ? ViewData["Active"] : (ViewData.Model.Active != null ? ViewData.Model.Active : false)

you can forget the fluff if you like:

=Html.CheckBox("Active", ViewData.Model.Active)

..causes the same problem.

when i try to update my model with:

UpdateModel(vacancy, Request.Form.AllKeys);

..i get the object array return with two bool fields. ok, so i understand the need for the hidden field. but im using MVC Beta and i believe the post data is not being processed by UpdateModel correctly. i get this error: System.FormatException "String was not recognized as a valid Boolean." ..when the form posts back sometimes. What i mean by that is that the form works fine, saving true and false states, except when another field on the form is empty. then it complains about the "true,false" value. and thats fine. i understand that a string "true,false" is not a valid bool but y does it complain sometimes and other times work? pls help

EDIT: please, if some1 can even suggest another approach to the UpdateModel() method, i'll look at that. i suspect tho that this is something simple i'm missing.

EDIT 2: this seems to be a known bug in MVC Beta (http://www.codeplex.com/aspnet/WorkItem/View.aspx?WorkItemId=2671&FocusElement=CommentTextBox). can anyone suggest a workaround?

A: 

Solved in ASP.net MVC 1.0

(added the answer so we can eliminate the question from Unanswered)

Eduardo Molteni
tidy data is good right. haha
cottsak