From f6302e438bfc4fd023e5d759ef1a52bc97029d20 Mon Sep 17 00:00:00 2001 From: yekalkan Date: Thu, 26 Apr 2018 15:35:58 +0300 Subject: [PATCH] Inner html render --- .../TagHelpers/AbpTagHelperService.cs | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs index 6c5e0c14a1..38f5878cd0 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs @@ -1,4 +1,8 @@ -using System.Threading.Tasks; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Encodings.Web; +using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.TagHelpers; namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers @@ -25,5 +29,28 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers Process(context, output); return Task.CompletedTask; } + + protected string RenderInputTagHelper(TagHelperAttributeList attributeList, AbpTagHelper abpTagHelper, HtmlEncoder htmlEncoder) + { + var innerOutput = new TagHelperOutput("div", attributeList, (useCachedResult, encoder) => Task.Run(() => new DefaultTagHelperContent())) + { + TagMode = TagMode.SelfClosing + }; + + var innerContext = new TagHelperContext(attributeList, new Dictionary(), Guid.NewGuid().ToString()); + + abpTagHelper.Process(innerContext, innerOutput); + + return RenderTagHelperOutput(innerOutput, htmlEncoder); + } + + protected string RenderTagHelperOutput(TagHelperOutput output, HtmlEncoder htmlEncoder) + { + using (var writer = new StringWriter()) + { + output.WriteTo(writer, htmlEncoder); + return writer.ToString(); + } + } } } \ No newline at end of file