I created my own anchor tag using MVC 6 Tag Helper. It works fine if I give the innerHtml from a property but I want to give the innerHtml directly from HTML. Here is my TagHelper code for the custom anchor
public string Text { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
var builder = new TagBuilder("a");
output.Attributes.Add("data-controller", Controller);
output.Attributes.Add("data-action", Action);
if (!string.IsNullOrEmpty(Text))
{
builder.InnerHtml.Append(Text); // INNER HTML IS HERE!!!
}
builder.AddCssClass("btn btn-link");
output.Content.SetContent(builder);
base.Process(context, output);
}And the usage is like this now (Current situation - it works)
<anchor-box name="ALink" controller="A" action="D" text="innertext From Here"></anchor-box>
Is it possible to give the inner html text directly while using in the cshtml like the following? (Needed situation - currently not works)
<anchor-box name="ALink" controller="A" action="D">Directly Here</anchor-box>
Any help appreciated