protected override void Render(System.Web.UI.HtmlTextWriter writer) { this.CssClass = "form-control " + this.CssClass; StringBuilder sb = new StringBuilder(); Attributes.Add("autocomplete", AutoComplete ? "on" : "off"); if (this.HasEvent("EventTextChanged")) { this.AutoPostBack = true; } if (Mask != MaskTextBox.NaoDefinido) { if (Mask == MaskTextBox.Decimal || Mask == MaskTextBox.Integer) { Attributes.Add("data-control-allownegative", AllowNegativeValues.ToString()); if (Mask == MaskTextBox.Decimal && DecimalPlaces > 0) { Attributes.Add("data-control-decimalplaces", DecimalPlaces.ToString()); } } this.Attributes.Add("data-control", Mask.ToString()); } if (montagroup) { writer.Write(ComponentUtils.RenderControlOpen(this.campoobrigatorio ? "*" + this.label : this.label, this.ID, TypeControl, TextBoxIcon != FontAwesomeIcons.NotSet, ObrigatorioVazio, ToolTip)); } base.Attributes.Add("data-control-required", campoobrigatorio.ToString()); if (TextBoxIcon != FontAwesomeIcons.NotSet) { writer.Write("<span class=\"input-group-addon\"><i class=\"{0} {1}\"></i></span>", TextBoxIconType.GetStringValueClass(), TextBoxIcon.GetStringValueClass()); base.Render(writer); } else { if (GroupButtons.Count > 0) { writer.Write("<div class='input-group'>"); if (GroupButtons.Count(p => p.ButtonPosition == InputGroupButton.InputGroupButtonPosition.Left) > 0) { writer.Write("<div class='input-group-btn'>"); foreach (var btn in GroupButtons.Where(p => p.ButtonPosition == InputGroupButton.InputGroupButtonPosition.Left)) { btn.RenderControl(writer); } writer.Write("</div>"); } } base.Render(writer); if (GroupButtons.Count > 0) { if (GroupButtons.Count(p => p.ButtonPosition == InputGroupButton.InputGroupButtonPosition.Right) > 0) { writer.Write("<div class='input-group-btn'>"); foreach (var btn in GroupButtons.Where(p => p.ButtonPosition == InputGroupButton.InputGroupButtonPosition.Right)) { btn.RenderControl(writer); } writer.Write("</div>"); } writer.Write("</div>"); } } if (montagroup) { writer.Write(ComponentUtils.RenderControlClose(help, TypeControl, TextBoxIcon != FontAwesomeIcons.NotSet)); } }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { string cssclass = " " + this.CssClass; CssClass = string.Empty; if (montagroup) { writer.Write(ComponentUtils.RenderControlOpen("", this.ID, TypeControlForm.Default)); } if (DataValue != null && DataValue.Count > 0) { Attributes.Add("data-values", string.Join(";", DataValue.Select(x => x.Key + "=" + x.Value).ToArray())); } if (ButtonType == ButtonType.Default) { if (ToolBarButton) { this.CssClass = "btn btn-default "; } else { this.CssClass += ButtonStyle.GetStringValueClass() + " "; } } else if (ButtonType == ButtonType.QuickButton) { this.CssClass = "quick-button "; this.CssClass += ButtonStyle.GetStringValueClass() + " "; } else if (ButtonType == ButtonType.Inline) { CssClass = ButtonStyle.GetStringValueClass() + " btn-inline "; CssClass += cssclass; } if (ButtonSize != ButtonSize.NotSet) { this.CssClass += ButtonSize.GetStringValueClass() + " "; } if (!String.IsNullOrWhiteSpace(this.ToolTip)) { this.Attributes.Add("data-toggle", "tooltip"); this.Attributes.Add("title", this.ToolTip); this.Attributes.Add("data-placement", "bottom"); this.ToolTip = string.Empty; } //Prevent Double Click this.Attributes.Add("AllowDoubleClick", AllowDoubleClick.ToString().ToLower()); if (!String.IsNullOrWhiteSpace(this.ModalName)) { this.Attributes.Add("data-toggle", "modal"); this.Attributes.Add("data-target", string.Format("#{0}", this.ModalName)); this.OnClientClick += $"$('#{ModalName}_OpenedModal').val('true');$('#{ModalName}').one('shown.bs.modal', function (e) {{modalAutoPositioning()}});return false;"; } else if (!String.IsNullOrWhiteSpace(PathAddValue)) { this.OnClientClick += String.Format("OpenAddModal(\"{0}\",\"../{1}\",\"{2}\");return false;", this.ClientID, PathAddValue, Page.ResolveClientUrl("~/Includes/images/loader.gif")); } this.UseSubmitBehavior = false; this.CssClass += cssclass; if (!string.IsNullOrWhiteSpace(NotificationValue)) { CssClass += " btn-notification"; } if (GroupButtons.Count(p => p.Visible) > 0) { writer.Write("<div class='btn-group'>"); } base.Render(writer); if (GroupButtons.Count(p => p.Visible) > 0) { writer.Write("<button type='button' class='btn {0} dropdown-toggle' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>", ToolBarButton ? "btn-default" : ButtonStyle.GetStringValueClass()); writer.Write("<span class='caret'></span><span class='sr-only'>Toggle Dropdown</span></button>"); writer.Write("<ul class='dropdown-menu'>"); foreach (var item in GroupButtons.Where(p => p.Visible)) { writer.Write("<li><a href='javascript:void(0)' onclick='__doPostBack(\"{0}\",\"\")'>{1}</a></li>", item.ID, item.Text); } writer.Write("</ul>"); writer.Write("</div>"); } if (montagroup) { writer.Write(ComponentUtils.RenderControlClose("", TypeControlForm.Default)); } }