tags:

views:

33

answers:

1

I'm trying to bind a prefix to a complex type... any idea how?

e.g.

instead of this...

public ActionResult Index([Bind(Prefix = "ids[]")] IList<long> ids)
{
...
}

i want to

public ActionResult Index(ComplexModel model)
{
...
}

where the model is something like

public class ComplexModel
{
    [Bind(Prefix = "ids[]")]  // <----- this is not allowed
    public IList<long> ids { get; set;}
}

Any idea how?

Thanks.

A: 

Have a look at this blog post from Scott Hanselman.

It describes in detail how to bind these types of lists.

Robert Harvey
i'm not sure if that actually answers the question... i'm trying to put a prefix so i can name it via a string and map it to the model... I'm actually having problem with ids[] as the data is from facebook and not generated by me. it doesn't seem to work unless it is ids[0],ids[1], etc or just ids
Kelvin