首页 > Web开发 > 详细

.net Core 中将原MVC中的 MvcHtmlString转换

时间:2019-02-18 14:16:29      阅读:534      评论:0      收藏:0      [点我收藏+]
public static IHtmlContent CustomLabelFor(this IHtmlHelper helper, Expression> expression, object htmlAttributes) { string result; TagBuilder div = new TagBuilder("div"); div.MergeAttribute("class", "form-group"); var label = helper.LabelFor(expression, new { @class = "control-label col-lg-1" }); div.InnerHtml.AppendHtml(label); using (var sw = new System.IO.StringWriter()) { div.WriteTo(sw, System.Text.Encodings.Web.HtmlEncoder.Default); result = sw.ToString(); } return new HtmlString(result); }

.net Core 中将原MVC中的 MvcHtmlString转换

原文:https://www.cnblogs.com/yingger/p/10395279.html

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