public HtmlTagWrapper Wrap(string tag, string innerText, object anonymousAttributes) { HtmlTagWrapper wrap = new HtmlTagWrapper(tag); if (anonymousAttributes != null) { wrap.ReflectAttributesFromAnonymousType(anonymousAttributes); } if (!string.IsNullOrWhiteSpace(innerText)) { wrap.Children.Add(new HtmlTagWrapperTextNode(innerText)); } return(wrap); }
public static HtmlTagWrapper Wrap(this HtmlHelper html, string tag, string innerText, object anonymousAttributes, params IHtmlTagWrapper[] children) { var wrap = new HtmlTagWrapper(tag); if (anonymousAttributes != null) { wrap.ReflectAttributesFromAnonymousType(anonymousAttributes); } if (!string.IsNullOrWhiteSpace(innerText)) { wrap.AddChild(new HtmlTagWrapperTextNode(innerText)); } foreach (var child in children) { wrap.AddChild(child); } return(wrap); }