tags:

views:

175

answers:

2
A: 

Without being able to see your View code, I'm going to assume that MVC's default model binder isn't able to reconcile your view with your model.

Scott Hanselman blogged about how you can take advantage of the relationship between your View and the default model binder.

JMP
+1  A: 

You don't want to bind the entire page to the collection.

  • Create a class called MyViewModel (or whatever makes sense, use the name of the View in the name.) Make that class the basis of your strongly-typed View.
  • Add the SelectableCollection<T> as a property of the ViewModel (call it SelectedProducts or whatever,) and populate it in the Controller.
  • Bind the checkboxes to the SelectedProducts property.

Also, are you using a custom CheckBoxList helper? There is not one out-of-the-box with ASP.NET MVC. Use this post to build your checkboxes:

http://stackoverflow.com/questions/220020/how-to-handle-checkboxes-in-asp-net-mvc-forms

Dave Swersky