this.RenderView("myView");
/// <summary>
/// get html from view
/// </summary>
public string RenderView(string ViewName)
{
var content = string.Empty;
var view = ViewEngines.Engines.FindView(ControllerContext, ViewName, null);
using (var writer = new StringWriter())
{
var context = new ViewContext(ControllerContext, view.View, ViewData, TempData, writer);
view.View.Render(context, writer);
writer.Flush();
content = writer.ToString();
}
return content;
}
No comments:
Post a Comment