I want to push a string through the Razor engine and get a converted string, in my controller.
Thanks to this question: Generate html from razor template in controller I am able to convert a PartialView into a full "Razor'd" string. However what I want to do is supply HTML with Razor syntax to the function and have it spit out the Razor'd string.
How can I pass a string to the Razor view engine? Alternatively can I create a view / partial view in the controller and pass that through?
Is RazorEngine http://razorengine.codeplex.com/ the only way?
EDIT: As I understand it, in the code in the referenced post FindPartialView() is just loading some HTML (the .cshtml file) into the ViewEngine. To my mind if I can substitute this .cshtml file with a string it will work in the same way. So how is it that here is no similar method or way of tricking the function call into accepting it?
Chris Pratt asked why I don't wish to use RazorEngine (I am presently evaluating it but cannot get EditorFor() to work). My boss will question the reliance on unsupported software (tiny SO community, not often updated project) hence I'm looking at an alternative.
If I can use the existing MS code with a partial or full view as in the other post, surely I can use a string or even save a .cshtml to disk and then give it that.