I have the following code in razor:
@for (int i = 0; i < Model.Count; i++)
{
using (Html.BeginForm("Bonnen", "Bon"))
{
<tr>
<td> @Html.TextBoxFor(model => Model[i].Id)</td>
<td>@Html.DisplayFor(model => Model[i].Date)</td>
<td>@Html.DisplayFor(model => Model[i].Description)</td>
<td><button type="submit" value="Details" class="btn btn-info">Details</button></td>
</tr>
}
}
When i post the data to the controller it becomes empty. I've already seen a question where it said you can't use a foreach loop here. On the website itself it does show all the data, but it won't give it to the controller.
Controller:
[HttpPost]
public ActionResult Bonnen(Bon bon)
{
return RedirectToAction("Details", "Bon", bon);
}
Model:
public int Id { get; set; }
public string Description { get; set; }
public DateTime Date { get; set; }