MVC actionlink posting List of complex type

Posted by Ying on Stack Overflow See other posts from Stack Overflow or by Ying
Published on 2010-03-24T16:12:21Z Indexed on 2010/03/24 16:13 UTC
Read the original article Hit count: 292

Filed under:
|
|

I have an actionlink that on click im passing a List of objects to a controller action.

Example:

View:

Html.ActionLink("TestLink", "TestMethod", "Test", Model.SampleList, null)

TestController:

public ActionResult TestMethod(List sampleList)
{
return View(sampleList);
}

When I do this I get a null sampleList. I can pass a single complex object fine just not a collection of it. Do I need the correct routing for this? The reason I'm doing this is instead of passing an id and do a look up in the controller action, I just pass in the data.

© Stack Overflow or respective owner

Related posts about mvc

Related posts about html.actionlink