MVC actionlink posting List of complex type
- by Ying
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.