generate a dropdown list from array data using razor .net mvc 1

generate a dropdown list from array data using razor .net mvc

@Html.DropDownList("myList", ViewBag.myList as SelectList)

Here is what the above code is Doing:
1. The ViewBag.myList is a SelectList object that is created in the controller.
2. The ViewBag.myList is passed to the view.
3. The ViewBag.myList is then used to create a dropdown list in the view.

Similar Posts