Search code examples
model-view-controllertemplatescode-behind

MVC .NET using Html.EditorFor in my controller


I'm using Custom Editor Templates in my view, and I would to know if is possible to obtain the same result from my controller.

<%: Html.EditorFor(model => model.Book) %>

Does anyone knows if it's possible?


Solution

  • I found a possible solution:

    add an user control and call Html.EditorFor(model => model.Book) inside. Then in my controller I just have to call View(usercontrol,model)

    Does anyone have a better idea?