A dropdownlist in MVC is a collection of SelectListitem objects. Depending on your project requirement you may either hard code the values in code or retrieve them from a database table.
First here we show dropdownlist using hard coded value.
Write following code to your view.
Now run application.(ctrl + F5).
First here we show dropdownlist using hard coded value.
Write following code to your view.

Now run application.(ctrl + F5).

Now write code in Index action for retrieve data from database.

Right click on Index action and Add View and write following code.

Now run application.(ctrl + F5).

Post a Comment