Returning a Built-In EditorTemplate as a PartialView in an Action
-
27-10-2019 - |
Question
Is there a way to return a built-in editor template - not a custom editor template - as a PartialView in an action?
I'd like to do something like this:
return PartialView("Collection", person.Children);
Thanks in advance
Solution
AFAIK there is no way to do this from a controller action. You could return a custom partial view:
return PartialView(person.Children);
that will invoke the editor template:
@model IEnumerable<Foo>
@Html.EditorForModel()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow