Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        public void MultipleSelect()
        {
            var modal = new MultipleSelect();
            var a     = modal.ToHtml();

            Console.WriteLine(a);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 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;
		}
Esempio n. 6
0
        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);
        }