【问题标题】:Get HTML Content string from Taghelper从 Taghelper 获取 HTML 内容字符串
【发布时间】:2019-11-16 13:23:15
【问题描述】:

如何获取从 Taghelper 呈现的 HTML?假设我为自定义复选框创建了 Taghelper。将 html 存储在变量中的代码是什么?

checkboxTagHelper.ProcessAsync(checkboxContext, checkboxOutput);

此外,我注意到 renderHtmlAttributes 在 .Net Core 中不起作用。但是适用于常规 Mvc 4.6.3。这可能是正确的方法吗? .Net Core 中的等效方法是什么?

http://blog.techdominator.com/article/rendering-a-tag-helper-inside-another-tag-helper.html

 return $"<{innerOutput.TagName} {renderHtmlAttributes(innerOutput)}>{innerOutput.Content.GetContent()}</{innerOutput.TagName}>";

【问题讨论】:

    标签: c# asp.net-core asp.net-core-mvc .net-core-2.0 tag-helpers


    【解决方案1】:

    只是研究,我相信答案是这样的。似乎正在为我工​​作。

    return output.Content.GetContent();
    

    【讨论】:

      猜你喜欢
      • 2013-07-03
      • 1970-01-01
      • 2016-11-20
      • 2020-06-16
      • 1970-01-01
      • 1970-01-01
      • 2017-10-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多