【发布时间】: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