Editor Templates for List<string>

对着背影说爱祢 提交于 2019-12-04 09:15:54

You can name the editor template Foo.cshtml where Foo is the type of the list: List<Foo>. Then simply:

@Html.EditorFor(x => x.FooList)

and if FooList is an IEnumerable<Foo> your editor template will be automatically rendered for each element of this list. So if you already have editor templates for the basic data types such as String, Decimal, DateTime, ... when you do @Html.EditorFor(x => x.SomeList) your editor templates will be picked up.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!