I recently ran into a situation where I would like to use a tag helper within a tag helper. I looked around and couldn\'t find anyone else trying to do this, am I using a po
No you cannot. TagHelpers are a Razor parse time feature.
One alternative is creating a TagHelper and manually invoking its ProcessAsync/Process method. Aka:
var anchorTagHelper = new AnchorTagHelper
{
Action = "Home",
};
var anchorOutput = new TagHelperOutput("a", new TagHelperAttributeList(), (useCachedResult, encoder) => new HtmlString());
var anchorContext = new TagHelperContext(
new TagHelperAttributeList(new[] { new TagHelperAttribute("asp-action", new HtmlString("Home")) }),
new Dictionary