How to render scripts, generated in TagHelper process method, to the bottom of the page rather than next to the tag element?

后端 未结 7 1420
情深已故
情深已故 2020-12-11 06:28

I am generating scripts in process method of TagHelper class as follows

[TargetElement(\"MyTag\")]
    public Class MYClass: TagHelper{
      public override         


        
7条回答
  •  死守一世寂寞
    2020-12-11 07:24

    Maybe not the most elegant solution but still working:

    Wrap the tag that you want to generate inside a span and then append some HTML to the InnerHtml of this span:

     myTag = new TagBuilder("span");
     var mymask = htmlGenerator.GenerateTextBox(...);
     myTag.InnerHtml.AppendHtml(mymask);
     myTag.InnerHtml.AppendHtml(@"");
    

提交回复
热议问题