我无法在服务器端检索简单的列表。请问有人能指导我正确的方向吗?
public class TestList
{
public string id { get; set; }
public string name { get; set; }
public string location { get; set; }
}
表单:
@model List<SampleMVC4App.Controllers.TestList>
@{
ViewBag.Title = "Index";
}
<h2>
Index</h2>
@using (Html.BeginForm())
{
<input name="cust" value="1" type="hidden" />
<input name="[1].id" value="de107502-284d-459b-80a1-762ce0860cd8" type="hidden" />
<input name="[1].name" value="test1" type="hidden" />
<input name="[1].location" value="location1" type="hidden" />
<a id="AddAnother" href="#">Add</a>
<input type="submit" value="submit" />
}
控制器:
[HttpPost]
public ActionResult Edit(ICollection<TestList> cust) **<---Null**
{
return View();
}