/// <summary> /// Creates the control main element. /// </summary> /// <returns></returns> protected override IFWHtmlElement CreateControl() { FWLabelElement label = new FWLabelElement(); label.MergeAttributes(Attributes); if (!string.IsNullOrWhiteSpace(CustomCss)) { label.AddCssClass(CustomCss); } label.For = _propertyName; if (_isRequired) { FWSpanElement span = new FWSpanElement(); span.AddCssClass("required"); span.Attributes.Add("aria-required", "true"); span.Add("*"); label.Add(span); } if (!string.IsNullOrWhiteSpace(_displayName)) { label.Add(_displayName); if (_tooltip != null) { label.Add($" <i class=\"fa fa-info-circle\" data-toggle=\"tooltip\" data-skin=\"dark\" title=\"{_tooltip}\"></i>"); } } return(label); }
private FWLabelElement CreateRadiobutton(string key, string value, string id) { var label = new FWLabelElement(); label.AddCssClass("m-radio"); var radiobutton = new FWRadiobuttonElement(Name) { Id = id, IsChecked = _selected.ToLower() == key.ToLower(), Value = key }; radiobutton.Attributes.Add("data-rule-required", IsRequired.ToString().ToLower()); radiobutton.Attributes.Add("data-msg-required", ViewResources.Validation_Required_Selection); if (IsDisabled) { label.AddCssClass("m-radio--disabled"); radiobutton.Attributes.Add("disabled", "disabled"); } if (DataBind) { DataBind.AddMainBind(FWBindConfiguration.CHECKED); radiobutton.DataBind = DataBind.CreateBind(); } label.Add(radiobutton); label.Add(value); label.Add(new FWSpanElement()); return(label); }
private FWLabelElement CreateCheckbox(string key, string value, string id) { var label = new FWLabelElement(); label.AddCssClass("m-checkbox m-checkbox--square"); var checkbox = new FWCheckboxElement(Name) { Id = TagBuilder.CreateSanitizedId(id, "_"), IsChecked = _selected.Contains(key), Value = key }; checkbox.Attributes.Add("data-rule-required", IsRequired.ToString().ToLower()); checkbox.Attributes.Add("data-rule-minlength", _minimumOptions.ToString()); checkbox.Attributes.Add("data-msg-required", string.Format(ViewResources.Validation_Required_Min, _minimumOptions)); if (IsDisabled) { label.AddCssClass("m-checkbox--disabled"); checkbox.Attributes.Add("disabled", "disabled"); } if (DataBind) { DataBind.AddMainBind(FWBindConfiguration.CHECKED); checkbox.DataBind = DataBind.CreateBind(); } label.Add(checkbox); label.Add(value); label.Add(new FWSpanElement()); return(label); }