I have a class called Parameters.
public class Parameters
{
public string Name { get; set; }
//other properties
public List<LatLong> Coordinates { get; set; }
}
LatLong is this:
public class LatLong
{
public double Latitude { get; set; }
public double Longitude { get; set; }
}
On the frontend, I have the following form for creating a new Parameters class.
@model Parameters
@using (Html.BeginForm("Index", "Home", FormMethod.Post))
{
@Html.EditorForModel()
}
I have an EditorTemplate for a List: Views/Shared/EditorTemplates/LatLongList.cshtml
@model List<LatLong>
@foreach (var ll in Model)
{
@Html.EditorForModel()
}
and an EditorTemplate for LatLong: Views/Shared/EditorTemplates/LatLong.cshtml
@model LatLng
@Html.EditorFor(model => model.Latitude)
@Html.EditorFor(model => model.Longitude)
However, nothing shows up.
How can I allow a user to input as many Coordinates as they want?