Here Mudassar Ahmed Khan has explained with an example, how to populate (bind) DropDownList from ViewBag in ASP.Net MVC Razor.
The records from the database will be populated into a Generic List collection of Model class objects and then will be saved into a ViewBag object.
Inside the View, the ViewBag object will be passed to the Html.DropDownList Helper function for populating the DropDownList in ASP.Net MVC Razor.
↧