asp.net mvc - bootstrapping object via model binder

Posted by csetzkorn on Stack Overflow See other posts from Stack Overflow or by csetzkorn
Published on 2010-03-08T17:37:33Z Indexed on 2010/03/08 17:51 UTC
Read the original article Hit count: 452

Filed under:

Hi,

I have a domain object Thing which can contain several Categories. So I have implemented my HTML helper to create a checkbox group of all possible Categories. I have no problem receiving:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Thing Thing, List<string> Categories)

However I am wondering whether I could use a custom Model binder to use just this:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Thing Thing)

So basically I am looking for a way to use the model binder to bootstrap the object tree/graph.

Any pointers appreciated. Thanks.

Christian

© Stack Overflow or respective owner

Related posts about asp.net-mvc