I need the Html helper from a view to be accessed inside a template, so I can do this inside a view:
ViewData["RootHtmlHelper"]=Html;
Inside the template this html helper can so be catched.
But how to do that without changing anything in the original view code which doesn’t have the line "ViewData["RootHtmlHelper"]=Html;" ?
Does have a way to do that using IViewEngine ?
During View life-cycle where the Html helper starts to be “alive” ?
Thanks.
I tried a lot of things, like partial views, RazorEngine, … and a wrapping to
EditorForModel().In my own
EditorForModel()I wrapped a call to the originalEditorForModel()and before to call it, I setted inViewDataa referece toHtml helper. In my template I can recover theHtml helperfromViewData, and all worked well, without to use stubs in all my views.