-1
我有一个包含Milestone
列表的模型,我希望该列表可以在网页中使用给定的一组文本框填充(模型内部)。如何在模型中填充数组以便回发
public class Project
{
public string ProjectNumber { get; set; }
public IList<Parameter> Parameters;
public IList<Milestone> MilestoneList = new List<Milestone>();
}
而在我的Html.BeginForm("Edit", "Home", FormMethod.Post, new { Project = Model }))
里面我有下面的TextBox。
@for (int i = 0; i < Model.MilestoneList.Count; i++)
{
<td style="align-content: center;">@Html.TextBoxFor(model=>model.MilestoneList[i].Value)</td>
}
我在下面milestonelist我的控制问题一直是样板工程null
[HttpPost]
public ActionResult Edit(Project project)
{
helper.CreateProject(project, System.Web.HttpContext.Current.User.Identity.Name);
return View();
}
所以,我应该怎么这么编程模型内部名单将通过文本框填充?