I have dropdown value that is populated using viewBag in controller.
ViewBag.Excursion = excursions_List.ResultList.Select(x => new SelectListItem()
{
Text = x.ExcursionName,
Value = x.ExcursionName,
});
Following is the code that I used in view. For this scenario I have value for model.Excursion. But its not getting selected in the dropdown value. Dropdown is still showing empty value.
@Html.DropDownListFor(model => model.Excursion, new SelectList(ViewBag.Excursion, "Value", "Text"), " ", new { @class = "form-control" })
Can anybody point out what am I doing here wrongly?
Thanks.