Populate the DropDownList control by using generic list.
To bind the DropDownList by using MVC generic list, the list of values from controller to the view is passed as illustrated in the following code example.
Create the class “Bikes” and define the properties in that class section, so that it is used in the controller. Refer to the following code to define the class.
Create the strongly typed view by using generic list class, to get the list of values as illustrated in the following code example.
In the dropdown list fields property, you can pass the following parameters other than id, text, value;
This page will automatically be redirected to the sign-in page in 10 seconds.