html dropdownlist to controller

Why don’t you try with ViewModel, and SelectListItem? I would do something like this


Model.Employees = employeesList.Select(employee => new SelectListItem
    Text = employee.FullName,
    Value = employee.Id


@Html.DropDownListFor(m => m.EmployeeId, new SelectList(Model.Employees, "value", "text"))

EmployeeId should be string. And then you just need to set EmployeeId.

Browse More Popular Posts

Leave a Comment