/// <summary> /// In HTML konvertieren /// </summary> /// <returns>Das Control als HTML</returns> public override IHtmlNode ToHtml() { CancelButton.Url = RedirectUrl; var classes = new List <string>(); classes.Add(Class); switch (Layout) { case TypesLayoutForm.Inline: classes.Add("form-inline"); break; } // Prüfe ob Formular abgeschickt wurde if (string.IsNullOrWhiteSpace(GetParam(SubmitButton.Name))) { OnInit(); } var button = SubmitButton.ToHtml(); var next = SubmitAndNextButton.ToHtml(); var cancel = CancelButton.ToHtml(); var html = new HtmlElementForm() { ID = ID, Class = string.Join(" ", classes.Where(x => !string.IsNullOrWhiteSpace(x))), Style = Style, Name = Name.ToLower() != "form" ? "form_" + Name.ToLower() : Name.ToLower(), Action = Url, Method = "post" }; html.Elements.AddRange(Content.Select(x => x.ToHtml())); foreach (var v in ValidationResults) { var layout = TypesLayoutAlert.Default; switch (v.Type) { case TypesInputValidity.Error: layout = TypesLayoutAlert.Danger; break; case TypesInputValidity.Warning: layout = TypesLayoutAlert.Warning; break; case TypesInputValidity.Success: layout = TypesLayoutAlert.Success; break; } html.Elements.Add(new ControlAlert(Page) { Layout = layout, Text = v.Text, Dismissible = true, Fade = true }.ToHtml()); } foreach (var v in Items) { html.Elements.Add(new ControlFormularLabelGroup(this) { Item = v }.ToHtml()); } html.Elements.Add(button); if (EnableSubmitAndNextButton) { html.Elements.Add(next); } if (EnableCancelButton) { html.Elements.Add(cancel); } return(html); }