So I'm trying to create a little tool where a user can select a set of days. I however need quite a complex model for extra data.
public class DayRange{
...
List<DaySelected> Days
...
}
public class DaySelected{
public bool Selected{ get; set;}
public string DayName {get; set;}
public DaySelected(string Day){
Selected = false;
DayName = day;
}
}
My Razorpage looks like this:
@Model DayRange
...
<form asp-action="RegisterSelection" asp-controller="DayRegister">
<table>
@foreach (var Day in Model.Days)
{
<tr>
<td>
<input [email protected] />
</td>
</tr>
}
</table>
<button type="submit">Confirm</button>
</form>
My method Registerselection looks like this:
[HttpPost]
public IActionResult RegisterSelection(DayRange dr){
...
}
However, whenever I change any of textboxes, all of the selected bool values remain the same. Can anybody help me on my way? Thanks in advance!
