我有一个动作链接,单击时我将对象列表传递给控制器动作。
例子:
看法:
Html.ActionLink("TestLink", "TestMethod", "Test", Model.SampleList, null)
测试控制器:
public ActionResult TestMethod(List<SampleList> sampleList)
{
return View(sampleList);
}
当我这样做时,我得到一个空样本列表。我可以很好地传递一个复杂的对象,而不是它的集合。我需要正确的路由吗?我这样做的原因不是传递一个 id 并在控制器操作中进行查找,我只是传递数据。