public static MvcHtmlString BootstrapList(this HtmlHelper htmlHelper, List<string> elements, BootstrapListType listType = BootstrapListType.ordered) { var tagListContainer = listType == BootstrapListType.ordered ? new TagBuilder("ol") : new TagBuilder("ul"); if(listType == BootstrapListType.unstyled) tagListContainer.AddCssClass("unstyled"); foreach (string elem in elements) { tagListContainer.InnerHtml += "<li>" + elem + "</li>"; } return new MvcHtmlString(tagListContainer.ToString(TagRenderMode.Normal)); }
public static MvcHtmlString BootstrapList(this HtmlHelper htmlHelper, List <string> elements, BootstrapListType listType = BootstrapListType.ordered) { var tagListContainer = listType == BootstrapListType.ordered ? new TagBuilder("ol") : new TagBuilder("ul"); if (listType == BootstrapListType.unstyled) { tagListContainer.AddCssClass("unstyled"); } foreach (string elem in elements) { tagListContainer.InnerHtml += "<li>" + elem + "</li>"; } return(new MvcHtmlString(tagListContainer.ToString(TagRenderMode.Normal))); }