The Html.ListBox helper is a good choice if you need to represent many-to-many relationships in a form.
Lets say you have a many-to-many between the Posts table and the Categories table. When you are creating a new post you need to select all the categories that it belongs to. When you are editing a post you need to show the categories it already belongs to in order to make a new selection (or not).

The ListBox would allow you to make all the selections necessary, so the Action and the View for the New Post would need something like this:
Action:
[AcceptVerbs("GET")]
public ActionResult New()
{
ViewData["Categories"] = _postService.GetCategories();
return View();
}
View:
<%= Html.ListBox("CategoryList", new MultiSelectList((IList<Category>)ViewData["Categories"], "ID", "Name"))%>
And the View and Action for the Edit would be like this:
Action:
[AcceptVerbs("GET")]
public ActionResult Edit(int? id)
{
int postId = id ?? 0;
//get the post that is being edited
Post post = _postService.GetPost(postId);
//get all the categories
ViewData["Categories"] = _postService.GetCategories();
//get the id's of the categories to which the post belongs
ViewData["CategoryIDs"] = post.Categories.Select(c => c.ID);
return View(post);
}
View:
<%= Html.ListBox("CategoryList", new MultiSelectList((IList<Category>)ViewData["Categories"], "ID", "Name", (IEnumerable<int>)ViewData["CategoryIDs"]))%>
Note that this time I had to pass an extra parameter to the ListBox method which is a list of the categories ID’s that are already associated with the Post. This list will be used to make the initial selection in the ListBox rendered in your HTML.
One last thing you need to know is how to get the ID’s of the selected categories back in your action. This is pretty simple as well. The Form will have a CategoryList item that will have a comma separated string with all the selected lines, all you need to do is split this in a array of strings and them save them to the database as you see fit.
string[] selected = Request.Form["CategoryList"].Split(',');
I hope this tip is useful to others that are testing the MVC Framework.