I just want a simple drop down list that will be populated by an IEnumerable. I have
@model WebApplication4.Models.VENDOR
The model contains an IEnumerable of BANK objects. I want the dropdown to be populated by a field of these objects, BANK_NAME. I'm new to MVC and .NET. This seems like an easy task, I just don't know how to do it.
Using a viewmodel which is specific to your view,
And in your GET Action method
And in your view, which is strongly typed to the
CreateVendor
viewmodel, you may use theDropDownListFor
helper method.And your HttpPost action method will be
If you want to replace the hardcoded
Banks
data with data from your tables. Replace the Class/Property names with your actual class/property names.