【发布时间】:2010-08-24 06:39:52
【问题描述】:
我创建了一个自定义 ViewModel,其中一个字段是 SelectList/DropDownlist。我想使用 EditorForModel 来显示 ViewModel。除 SelectList 外,所有字段均有效。我尝试了一些不同的东西,但没有任何结果。我在一篇文章中看到 EditorForModel 没有“足够聪明”来执行 DropDownList,我想知道这是否属实。 EditorForModel 更容易使用,输入更少:)
谢谢!
更新
我想通了。我最终做的是使用 UIHint("TemplateName") 并在 EditorTemplates 文件夹中创建了一个 .ascx 文件,输出符合我的预期。
【问题讨论】:
标签: asp.net-mvc-2 viewmodel selectlist