How to post the selected value of a selectlist to the controller using a view model?
问题 This question has been asked in various forms but none of the answers seem to fit my situation. I am simply trying to retrieve the selected value of a dropdown list in my controller. Here is my code: ViewModel.cs public class ViewModel { public ViewModel() {} public ViewModel(Contact contact, IEnumerable<State> states) { this.Contact = contact; this.States = new SelectList(states, "Id", "Name", contact.StateId); } public Contact Contact {get;set;} public SelectList States {get;set;} }