protected virtual string GetListBoxCssClass() { var builder = new CssClassBuilder(); AppendListBoxCssClass(builder); builder.Append("listbox"); return(builder.ToString()); }
protected virtual string GetCheckBoxCssClass() { var builder = new CssClassBuilder(); AppendCheckBoxCssClass(builder); builder.Append("checkbox"); foreach (var cssClass in CssClasses) { builder.Append(cssClass); } return(builder.ToString()); }
protected string GetControlCssClass() { var builder = new CssClassBuilder(); foreach (var cssPrefix in _cssPrefixes) { builder.Append(cssPrefix.EndsWith("_") ? cssPrefix + "control" : cssPrefix + "_control"); } AppendControlCssClass(builder); builder.Append("control"); return(builder.ToString()); }
protected virtual string GetDropDownListCssClass() { var builder = new CssClassBuilder(); foreach (var cssPrefix in CssPrefixes) { builder.Append(cssPrefix); } foreach (var classValue in CssClasses) { builder.Append(classValue); } return(builder.ToString()); }
protected virtual string GetTextBoxCssClass() { var builder = new CssClassBuilder(); foreach (var cssPrefix in CssPrefixes) { builder.Append(cssPrefix); } AppendTextBoxCssClass(builder); foreach (var cssClass in CssClasses) { builder.Append(cssClass); } return(builder.ToString()); }
protected virtual void AppendTextBoxCssClass(CssClassBuilder builder) { switch (_width) { case TextBoxWidth.Shorter: builder.Append("shorter_textbox"); break; case TextBoxWidth.Larger: builder.Append("wider_textbox"); break; case TextBoxWidth.Largest: builder.Append("widest_textbox"); break; } }
protected override void AppendControlCssClass(CssClassBuilder builder) { base.AppendControlCssClass(builder); // Add an error attribute if needed. if (string.IsNullOrEmpty(Name) || !Html.ViewData.ModelState.ContainsKey(Name)) { return; } var modelState = Html.ViewData.ModelState[Name]; var modelErrors = modelState == null ? null : modelState.Errors; if (modelErrors != null && modelErrors.Count > 0) { builder.Append("error"); } }
protected string GetFieldCssClass() { var builder = new CssClassBuilder(); foreach (var cssPrefix in _cssPrefixes) { builder.Append(cssPrefix.EndsWith("_") ? cssPrefix + "field" : cssPrefix + "_field"); } // Add options. if (IsRequired) { builder.Append("compulsory_field"); } if (IsReadOnly) { builder.Append("read-only_field"); } AppendFieldCssClass(builder); builder.Append("field"); return(builder.ToString()); }
protected virtual void AppendListBoxCssClass(CssClassBuilder builder) { }
protected virtual void AppendControlCssClass(CssClassBuilder builder) { }
protected virtual void AppendFieldCssClass(CssClassBuilder builder) { }
protected virtual void AppendCheckBoxCssClass(CssClassBuilder builder) { }