private static string BooleanTemplateDropDownList(bool? value, IDictionary<string, object> additionalValues, object attributes = null) { StringBuilder builder = new StringBuilder(); var htmlAttributes = HtmlHelper.AnonymousObjectToHtmlAttributes(attributes); var dataAttributes = additionalValues.GetDataAttributes(); var customAttributes = additionalValues.GetCustomAttributes(); dataAttributes.MergeAttributes(customAttributes); TagBuilder selectTag = new TagBuilder("select"); selectTag.AddCssClass("list-box"); selectTag.AddCssClass("tri-state"); selectTag.Attributes["disabled"] = "disabled"; selectTag.MergeAttributes(dataAttributes); selectTag.MergeAttributes(htmlAttributes); builder.Append(selectTag.ToString(TagRenderMode.StartTag)); foreach(SelectListItem item in Html5DefaultEditorTemplates.TriStateValues(value)) { builder.Append(Html5SelectExtensions.ListItemToOption(item)); } builder.Append(selectTag.ToString(TagRenderMode.EndTag)); return builder.ToString(); }