My ultimate goal is to generate output for razor tags
I have a TagHelper With name Ad-Plus.cs
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace DevCore.TagHelpres
{
// You may need to install the Microsoft.AspNetCore.Razor.Runtime package into your project
[HtmlTargetElement("Ad-Plus")]
public class Ad_Plus : TagHelper
{
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "div";
output.Attributes.SetAttribute("class", "hr-theme-slash");
output.Attributes.SetAttribute("data-toggle", "modal");
output.Attributes.SetAttribute("data-target", "#plusmodels");
@{
string template = "";
var service = RazorEngineService.Create();
service.AddTemplate("template", template);
service.Compile("template");
var result = service.Run("template");
}
@result
But the output result :
My ultimate goal is to generate output for razor tags
I have a TagHelper With name Ad-Plus.cs
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks;
namespace DevCore.TagHelpres { // You may need to install the Microsoft.AspNetCore.Razor.Runtime package into your project [HtmlTargetElement("Ad-Plus")] public class Ad_Plus : TagHelper { public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "div"; output.Attributes.SetAttribute("class", "hr-theme-slash"); output.Attributes.SetAttribute("data-toggle", "modal"); output.Attributes.SetAttribute("data-target", "#plusmodels");
}
Now I want to have a Render html TagHelper in output
@using RazorEngine; @using RazorEngine.Templating;
@{ string template = " ";
var service = RazorEngineService.Create();
service.AddTemplate("template", template);
service.Compile("template");
var result = service.Run("template");
} @result But the output result :