Created
September 30, 2015 20:13
-
-
Save bjoerntx/c8c1923044bdf3120b05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeController : Controller | |
{ | |
public ActionResult Index() | |
{ | |
return View(); | |
} | |
public ActionResult TemplateEditor() | |
{ | |
var myString = RenderViewToString("Editor.aspx"); | |
return Content(myString); | |
} | |
protected string RenderViewToString(string viewPath) | |
{ | |
System.IO.StringWriter htmlStringWriter = | |
new System.IO.StringWriter(); | |
Server.Execute(viewPath, htmlStringWriter); | |
return htmlStringWriter.GetStringBuilder().ToString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment