I am looking for the best method for creating a drop down list editor template with MVC. There seem to be various methods but I can’t find any method that is best, everyone seems to do it differently. I am using MVC3 with Razor as well, so a method that works with this is preferred.
Share
There are many ways and saying which is the best would be subjective and might not work in your scenario which by the way you forgot to describe in your question. Here’s how I do it:
Model:
Controller:
View (
~/Views/Home/Index.cshtml):Editor template (
~/Views/Home/EditorTemplates/MyViewModel.cshtml):