public MultipleSelectControl(MultipleSelect item, RepeatDirection direction) { this.item = item; l = new Label(); l.Text = item.Title; l.CssClass = "label"; l.AssociatedControlID = item.Name; this.Controls.Add(l); list = new CheckBoxList(); list.RepeatDirection = direction; list.ID = item.Name; list.CssClass = "alternatives"; list.DataSource = item.GetChildren(); list.DataTextField = "Title"; list.DataValueField = "ID"; list.DataBind(); this.Controls.Add(list); if (item.Required) { cv = new CustomValidator { Display = ValidatorDisplay.Dynamic, Text = "*" }; cv.ErrorMessage = item.Title + " is required"; cv.ServerValidate += (s, a) => a.IsValid = !string.IsNullOrEmpty(AnswerText); cv.ValidationGroup = "Form"; this.Controls.Add(cv); } }
public void MultipleSelect() { var modal = new MultipleSelect(); var a = modal.ToHtml(); Console.WriteLine(a); }
private void AddComponent(TagHelperOutput output) { var selectedItems = GetSelectedItemsToJsonString(); var rawPickerHtml = new HtmlString( "<div data-bind='component: { name: \"picker\", params: { search: \"\", hiddenId: \"" + Id + "\", url: \"" + Url + "\", selectedItemsTitle: \"" + SelectedItemsTitle + "\", searchInputPlaceholder: \"" + SearchInputPlaceholder + "\", selectedItems: " + selectedItems + ", minSearchText: " + MinSearchText + ", multipleSelect: " + MultipleSelect.ToString().ToLower() + " }}'></div>"); output.Content.AppendHtml(rawPickerHtml); }
public MultipleSelectControl(MultipleSelect item, RepeatDirection direction) { this.item = item; list = new CheckBoxList(); list.RepeatDirection = direction; }
public MultipleSelectControl(MultipleSelect item, RepeatDirection direction) { this.item = item; list = new CheckBoxList(); list.RepeatDirection = direction; }
private void AddComponent(TagHelperOutput output) { var selectedItems = GetSelectedItemsToJsonString(); var rawPickerHtml = new HtmlString($"<div data-bind=\'component: {{ name: \"picker\", params: {{ search: \"\", hiddenId: \"{Id}\", url: \"{Url}\", selectedItemsTitle: \"{SelectedItemsTitle}\", allowSuggestedItems: {AllowSuggestedItems.ToString().ToLower()}, searchResultTitle: \"{SearchResultTitle}\", suggestedItemsTitle: \"{SuggestedItemsTitle}\", noItemSelectedTitle: \"{NoItemSelectedTitle}\", searchInputPlaceholder: \"{SearchInputPlaceholder}\", showAllItemsTitle: \"{ShowAllItemsTitle}\", selectedItems: {selectedItems}, minSearchText: {MinSearchText}, topSuggestedItems: {TopSuggestedItems} ,multipleSelect: {MultipleSelect.ToString().ToLower()} }}}}\'></div>"); output.Content.AppendHtml(rawPickerHtml); }