I am creating a custom HTML Tag Helper:
public class CustomTagHelper : TagHelper
{
[HtmlAttributeName("asp-for")]
public ModelExpression DataModel { get; set; }
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
string content = RazorRenderingService.Render("TemplateName", DataModel.Model);
output.Content.SetContent(content);
}
}
How to render a partial view programatically an get the rendered content as a string inside TagHelper.ProcessAsync ?
Should I request the injection of an IHtmlHelper ?
Is it possible to get a reference to the razor engine ?