My view
<div class="form-group"><div class="row"><div class="col-sm-2"><label asp-for="Locations">Locations</label></div><div class="col-4"> @Html.DropDownListFor(m => m.WeatherLocation.LocationId, Model.Locations, "-Select a Location", new { @class = "form-control" })</div></div></div>
Model
public class WeatherVM { // public int LocationId { get; set; } public DateTime ForcastDate { get; set; } public WeatherLocation WeatherLocation; public IEnumerable<Weather> Weather { get; set; } public IEnumerable<SelectListItem> Locations { get; set; } } } public class WeatherLocation { [Key] public int LocationId { get; set; } [Required] public string LocationName { get; set; } [Required] public string Woeid { get; set; } }
Location table
id Name Woeid
1 EKM asdsds
2 PPP asdsad
I want to bring the dropdown in location please help