I am not able to retrieve a simple list on server side. Could anyone please point me in the right direction?
public class TestList
{
public string id { get; set; }
public string name { get; set; }
public string location { get; set; }
}
Form:
@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" />
}
Controller:
[HttpPost]
public ActionResult Edit(ICollection<TestList> cust) **<---Null**
{
return View();
}