public static void AddInputAttributeHtmlAttributes(this TagBuilder tagInput, string attributeName, RouteValueDictionary htmlAttributes) { if (htmlAttributes[attributeName] == null) { return; } tagInput.AddInputAttributeIsNotNullAndExpressionIsTrue(attributeName, htmlAttributes[attributeName], htmlAttributes[attributeName] != null); }
public static TagBuilder GenerateTagDisplay(string id, string caption, RouteValueDictionary htmlAttributes, string tooltip = null, bool isRequired = false, string requiredSymbol = null, string requiredMessage = null, string requiredClass = null) { TagBuilder tagSpan = isRequired ? GenerateTagSpanRequired(requiredSymbol, requiredMessage, requiredClass) : null; TagBuilder tagLabel = new TagBuilder("span"); tagLabel.AddInputAttributeIsNotNullAndExpressionIsTrue("id", id, id != null); tagLabel.AddInputAttributeHtmlAttributes("class", htmlAttributes); tagLabel.AddInputAttributeHtmlAttributes("style", htmlAttributes); if (tooltip != null && !string.IsNullOrEmpty(tooltip)) { tagLabel.AddInputAttributeStaticValue("data-toggle", "tooltip"); tagLabel.AddInputAttributeStaticValue("data-placement", "top"); tagLabel.AddInputAttributeIsNotNullAndExpressionIsTrue("data-original-title", tooltip, tooltip != null); } tagLabel.InnerHtml = caption + (tagSpan != null ? tagSpan.ToMvcHtmlString(TagRenderMode.Normal).ToString() : ""); return(tagLabel); }
public static TagBuilder GenerateTagEditor(string id, string text, RouteValueDictionary htmlAttributes, string tooltip = null, bool isRequired = false, bool disabled = false) { TagBuilder tagEdit = new TagBuilder("input"); tagEdit.AddInputAttributeStaticValue("type", "text"); tagEdit.AddInputAttributeIsNotNullAndExpressionIsTrue("id", id, id != null); tagEdit.AddInputAttributeHtmlAttributes("class", htmlAttributes); tagEdit.AddInputAttributeHtmlAttributes("style", htmlAttributes); tagEdit.AddInputAttributeIfExpressionIsTrue("required", null, isRequired); tagEdit.AddInputAttributeIfExpressionIsTrue("disabled", null, disabled); if (tooltip != null && !string.IsNullOrEmpty(tooltip)) { tagEdit.AddInputAttributeStaticValue("data-toggle", "tooltip"); tagEdit.AddInputAttributeStaticValue("data-placement", "top"); tagEdit.AddInputAttributeIsNotNullAndExpressionIsTrue("data-original-title", tooltip, tooltip != null); } tagEdit.AddInputAttributeStaticValue("value", text); return(tagEdit); }
public static TagBuilder GenerateTagProgress(string id, string caption, RouteValueDictionary htmlAttributes, double?value = null, double?maxValue = null, string tooltip = null, bool isRequired = false, bool disabled = false) { TagBuilder tagEdit = new TagBuilder("progress"); tagEdit.AddInputAttributeIsNotNullAndExpressionIsTrue("id", id, id != null); tagEdit.AddInputAttributeHtmlAttributes("class", htmlAttributes); tagEdit.AddInputAttributeHtmlAttributes("style", htmlAttributes); tagEdit.AddInputAttributeIfExpressionIsTrue("required", null, isRequired); tagEdit.AddInputAttributeIfExpressionIsTrue("disabled", null, disabled); if (tooltip != null && !string.IsNullOrEmpty(tooltip)) { tagEdit.AddInputAttributeStaticValue("data-toggle", "tooltip"); tagEdit.AddInputAttributeStaticValue("data-placement", "top"); tagEdit.AddInputAttributeIsNotNullAndExpressionIsTrue("data-original-title", tooltip, tooltip != null); } /* Injetando o Valor no Input... */ tagEdit.AddInputAttributeIsNotNullAndExpressionIsTrue("max", maxValue, maxValue != null); tagEdit.AddInputAttributeIsNotNullAndExpressionIsTrue("value", value, value != null); return(tagEdit); //return new TagBuilder_Progress<TModel, TProperty>(dynamicComponentBase).GenerateElementMvcString(TagRenderMode.Normal); }