首页 > 其他 > 详细

【TagHelper进阶系列】在TagHelper中使用其他TagHelper

时间:2020-03-11 22:49:27      阅读:102      评论:0      收藏:0      [点我收藏+]
var writer = new System.IO.StringWriter();
var
basedataTagHelper = new TagHelper_SelectBasedata(Generator, modelMetadataProvider) { //Url = Url.Action(baseData.Action, baseData.Controller), //remoteViewModel = baseData.ViewModel, //被调用TagHelper的配置参数 }; var basedataOutput = new TagHelperOutput("basedata", new TagHelperAttributeList(),(useCachedResult, encoder) => Task.Factory.StartNew<TagHelperContent>(() => new DefaultTagHelperContent())); var basedataContext = new TagHelperContext(new TagHelperAttributeList(), new Dictionary<object, object>(), Guid.NewGuid().ToString()); basedataTagHelper.ProcessAsync(basedataContext, basedataOutput).GetAwaiter().GetResult(); basedataOutput.WriteTo(writer, HtmlEncoder.Default);

//添加到当前TagHelper的DOM中
 output.Content.AppendHtml(writer.ToString());

在TagHelper中使用一个类名为TagHelper_SelectBasedata的TagHelper

【TagHelper进阶系列】在TagHelper中使用其他TagHelper

原文:https://www.cnblogs.com/cdoneiX/p/12465392.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!