I have a view for my customer object that allows him to choose a number of products.
In my view, want to show a list box (products chosen by my customer) and then on the client side add and remove items to it. I then need to pass all the data from the list box back to my action so that I can iterate over the list and save it in the database.
How do I pass the whole list back to the action and what should the parameters for the action?
On the client side I think I can add and remove option tags for the products chosen.
I am aware of model binding but I have no idea how I can bind a listbox to an object structure.
JD
This is a bit of an advanced solution, but I’ve found that using Knockout for doing list manipulation client-side is much easier than using MVC’s built in list support. Steve Sanderson has a great walk though on how to implement this. He also has a walk though using only MVC + forms. I’d suggest working through both. Either of these solutions will be much more maintainable/extensible than posting a comma separated string back to the server.