I’ve recently been working with ASP.NET Core to build some functionality involving building a list of values. Typically, with ASP.NET Core using Razor, you have a form that may look something like this:
@using (Html.BeginForm("MyAction", "ControllerName", FormMethod.Post)
{
@Html.AntiForgeryToken()
<div class="form-group">
@Html.LabelFor(model => model.MyValue)
@Html.TextBoxFor(model => model.MyValue)
</div>
<div class="form-group">
<button type="submit">Submit</button>
</div>
This works really well in 90% of cases, where you want the user to enter a value and submit. This is your average CRUD application; however, what happens if, for some reason, you need to manipulate one of these values? Let’s say, for example, that you want to submit a list of values.