I'm having trouble using "RenderPartialViewToString" without a controller class.
Currently creating HTML inside the application begins, for which it is necessary to create a model, create a scene and change the view in the HTML string.
In my opinion, it uses the HTML helper function / extension which is only one controller
Can anyone do this How can I do this?
razor The purse is now disliked. With version 3.5 of razor engine, you will follow the steps outlined here:
The text below is literally copied from the link above:
var results = Rajar. RazorTemplate, Model, cache_name)
Now either (when known in modeltype or you want to precompile at startup)
Once upon startup // (When an ITemplateManager knows how to solve cache_name) not required by using Engine.Razor.AddTemplate (cache_name, razorTemplate) // Startup Engine.Razor.Compile (cache_name, typeof (on MyModel) / * or model For getType () or null 'dynamic' * /) // Razor.Parse calls instead of result = Engine.Razor.Run (cache_name, typeof (MyModel) / * or model.GetType () or 'dynamic' * /, For model), // Once Rtap (when there is no need to use ITEMPetManager who knows how to solve Kas_nav) / code> or (when you want lazy compilation) engine. Razor Adaptat (cache_name, razor template) / instead of th e Razor.Parse call result = Engine.Razor.RunCompile (cache_name, typeof (MyModel) / * or model.GetType () or 'dynamic' * /, tap for model )
The meaning will be equal one liner (only to be used to quickly start with RazorEngine):
// This is just you (every Bar) AddTemplate will call for note that ITemplateManager has to support AddTemplate // and to create this function, it has to handle multiple calls for AddTemplate. Will // When using the same cash_name for the default template, the default implementation will throw an exception. Results for = engine.Razor.RunCompile (razorTemplate, cache_name, model.GetType () / * typeof (MyModel) or 'dynamic' * /, model
Comments
Post a Comment