private TagBuilder CommonRender(TagBuilder checkBox, TagBuilder label) { TagBuilder container = new TagBuilder("div"); TagBuilder element = container; container.AddCssClass("form-check"); this.AddCssClass("form-check-inline", _config.Horizontal, container); container.InnerHtml.AppendHtml(checkBox); container.InnerHtml.AppendHtml(label); this.AddAttribute("disabled", _config.Disabled, checkBox); checkBox.AddCssClass("form-check-input"); this.AddCssClasses(_config.CssClasses, container); if (_config.ColumnWidths != null) { TagBuilder group = new TagBuilder("div"); TagBuilder widthContainer = new TagBuilder("div"); TagBuilder offsetColum = new TagBuilder("div"); //string[] colClassParts = columnWidths.LeftColumn.CssClass().Split(new[] {'-'}); // Set an offset column class, since check boxes doesn't have labels to the left. //widthContainer.AddCssClass($"col-{colClassParts[1]}-offset-{colClassParts[2]}"); widthContainer.AddCssClass(_config.ColumnWidths.RightColumn.CssClass()); offsetColum.AddCssClass(_config.ColumnWidths.LeftColumn.CssClass()); group.AddCssClass("form-group row"); widthContainer.InnerHtml.AppendHtml(container); group.InnerHtml.AppendHtml(offsetColum); group.InnerHtml.AppendHtml(widthContainer); element = group; } TooltipRenderer.Render(checkBox, _config.Tooltip); return(element); }
private void CommonRender(string propValue = null) { if (_config.Default != null && !_config.Multiple) { Element.InnerHtml.AppendHtml($"<option>{_config.Default}</option>"); } foreach (var item in _config.Items) { string selected = propValue != null && item.Value == propValue ? "selected" : null; Element.InnerHtml.AppendHtml($"<option value=\"{item.Value}\" {selected}>{item.Text}</option>"); } this.AddAttribute("multiple", _config.Multiple); TooltipRenderer.Render(Element, _config.Tooltip); }
private IHtmlContent CommonRender(TagBuilder groupLabel, Func <object, IHtmlContent> radioBtnFunc) { TagBuilder group = new TagBuilder("div"); ColumnWidths columnWidths = _config.ColumnWidths; TagBuilder widthContainer = null; group.AddCssClass("form-group"); group.InnerHtml.AppendHtml(groupLabel); if (columnWidths != null) { widthContainer = new TagBuilder("div"); widthContainer.AddCssClass(columnWidths.RightColumn.CssClass()); group.InnerHtml.AppendHtml(widthContainer); } this.AddCssClass(columnWidths?.LeftColumn.CssClass(), columnWidths != null && groupLabel != null, groupLabel); foreach (RadioButtonConfig radioButtonConfig in _config.RadioButtons) { TagBuilder container = new TagBuilder("div"); TagBuilder radioButton = this.TagBuilderFromHtmlContent(radioBtnFunc(radioButtonConfig.Value), false); TagBuilder label = new TagBuilder("label"); this.AddAttribute("disabled", _config.Disabled, radioButton); radioButton.AddCssClass("form-check-input"); label.AddCssClass("form-check-label"); container.AddCssClass("form-check"); container.InnerHtml.AppendHtml(radioButton); container.InnerHtml.AppendHtml(label); this.AddCssClasses(radioButtonConfig.CssClasses, container); this.AddCssClass("form-check-inline", _config.Horizontal, container); if (!string.IsNullOrEmpty(radioButtonConfig.Label)) { label.InnerHtml.Append(radioButtonConfig.Label); } (widthContainer ?? group).InnerHtml.AppendHtml(container); TooltipRenderer.Render(radioButton, radioButtonConfig.Tooltip); } return(group); }
private void CommonRender() { this.AddAttribute("rows", _config.Rows.ToString()); this.AddAttribute("readonly", _config.ReadOnly); TooltipRenderer.Render(Element, _config.Tooltip); }
protected override void Render() { this.AddAttribute("placeholder", _config.PlaceHolder); this.AddAttribute("readonly", _config.ReadOnly); TooltipRenderer.Render(Element, _config.Tooltip); }