Populating Dropdown in ASP.net Core : <p>Does anyone know how to deal with Dropdowns in Asp.net core. I think I made myself very complicated to understand the new Asp.net core concept. (I am new to Asp.net Core).</p>

<p>I have models called <code>Driver</code>, <code>Vehicle</code>. Basically one can create bunch of vehicles in the master then attach it to the Driver. So that the driver will be associated with a vehicle.</p>

<p>My problem is that I am also using viewmodel in some area to combine two different models.(understood little from default template)</p>

<p>My problem is I have no idea what is the next step since ASP.net Core is very latest, there are not a lot of tutorials and Q/As available.</p>

<p>Driver Model</p>

<pre><code>public class Driver
{
    [Required]
    public int Id { get; set; }

    [Required]
    public string ApplicationUserId { get; set; }

    [Required]
    public int VehicleId { get; set; }

    [Required]
    public string Status { get; set; }


    public virtual ApplicationUser ApplicationUser { get; set; }
    public virtual Vehicle Vehicle { get; set; }
}
</code></pre>

<p>Vehicle Model</p>

<pre><code>public class Vehicle
{

    [Required]
    public int Id { get; set; }

    [Required]
    public string Make { get; set; }
    public string Model { get; set; }

    [Required]
    public string PlateNo { get; set; }
    public string InsuranceNo { get; set; }

}
</code></pre>

<p>ViewModel of Driver</p>

<pre><code>    public class DriverViewModel
{
    [Required]
    [Display(Name = "ID")]
    public int ID { get; set; }

    [Required]
    [Display(Name = "User ID")]
    public string ApplicationUserId { get; set; }

    [Required]
    [Display(Name = "Vehicle ID")]
    public IEnumerable&lt;Vehicle&gt; VehicleId { get; set; }
    //public string VehicleId { get; set; }

    [Required]
    [Display(Name = "Status")]
    public string Status { get; set; }


}
</code></pre>

<p>Here is my View</p>

<pre><code>&lt;div class="col-md-10"&gt;
   @*&lt;input asp-for="VehicleId" class="form-control" /&gt;*@
   @Html.DropDownList("VehicleId", null, htmlAttributes: new { @class = "form-control"})
   &lt;span asp-validation-for="VehicleId" class="text-danger" /&gt;
&lt;/div&gt;
</code></pre>
