ich ein Modell, das eine Liste der Milestone
enthält, mag ich, dass die Liste aufgefüllt wird (im Modell) mit einem gegebenen Satz von Textfeldern in der Webseite.Wie für Postbacks ein Modell eines Array in Seite füllen
public class Project
{
public string ProjectNumber { get; set; }
public IList<Parameter> Parameters;
public IList<Milestone> MilestoneList = new List<Milestone>();
}
Und in meinem Html.BeginForm("Edit", "Home", FormMethod.Post, new { Project = Model }))
habe ich die folgende TextBox.
@for (int i = 0; i < Model.MilestoneList.Count; i++)
{
<td style="align-content: center;">@Html.TextBoxFor(model=>model.MilestoneList[i].Value)</td>
}
Mein Problem in meinem Controller unter dem milestonelist ist immer null
in Modellprojekt
[HttpPost]
public ActionResult Edit(Project project)
{
helper.CreateProject(project, System.Web.HttpContext.Current.User.Identity.Name);
return View();
}
Wie soll ich so die Liste im Modell-Programm wird durch Textfelder ausgefüllt werden?