Monday, March 11, 2013

Html.DropDownListFor ASP.net MVC usage

Basically this is how I like to use DropDownListFor and SelectList in MVC

However  I have a simple class containing the items and the selection in one place:

Where I have these two pretty simple classes.
One class for each item:


And one class for the complete encapsulation:
This also allows me to keep my select list models independent of system.web 

No comments:

Post a Comment