Automatically create dropdown with EditorForModel()
I have a model with a
public IEnumerable<SelectListItem> Selections {get;set;}
and one public string SelectedItem {get;set;}
, how can I override the defaul开发者_开发问答t behavior in asp.net mvc so it renders a dropdown for this property? I have a generic edit ui so I can't do things like Html.DropDownListFor(...
Take a look at custom templates: http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-4-custom-object-templates.html
精彩评论