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

后端 未结 7 1412
情深已故
情深已故 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(@"<script>...</script>");
    
    0 讨论(0)
提交回复
热议问题