I would first like to take I am a novice at this, my background is asp web forms and I am trying to update my skill set to the latest development language.
I have a view which needs to access multiple modules so I created a viewmodel and pass that to the view. My problem is when I try to access a list from the view model to populate a select (dropdown). I keep getting an error. Below is my viewmodel: -
public class CustomerDetailsViewModel
{
public Customer customer { get; set; }
public IEnumerable<Lookups> titles { get; set; }
public List<Lookups> ePCs { get; set; }
public List<Lookups> jobStages { get; set; }
}
Below is my code for the select control. Where I try to access the titles list I get an error.
<div class="form-group">
<label asp-for="customer.Title_Id" class="col-sm-2 col-md-4 col-form-label">Title</label>
<select app-for="Title_Id" asp-items="@(new SelectList(titles,"PK_Id","Description"))"></select>
</div>