c# - Getting HTML Generated By ASP.NET MVC View -
c# - Getting HTML Generated By ASP.NET MVC View -
i'm working on asp.net mvc 4 app. i'm trying build study screen takes while (~30 seconds) generate due data. html that's generated view , save text file.
is there way html generated view? if so, how? please note .cshtml file includes razor. i'm not sure if plays equation or not.
thank much help!
i utilize next function sort of thing, when want create email html using razor:
public static string renderviewtostring(string viewname, object model, controllercontext context) { context.controller.viewdata.model = model; using (var sw = new stringwriter()) { var viewresult = viewengines.engines.findpartialview(context, viewname); var viewcontext = new viewcontext(context, viewresult.view, context.controller.viewdata, context.controller.tempdata, sw); viewresult.view.render(viewcontext, sw); homecoming sw.getstringbuilder().tostring(); } } c# asp.net-mvc-4
Comments
Post a Comment