Beispiel #1
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "div";
            output.Content.Clear();
            string id = "fapselect";

            if (Id.IsPresent())
            {
                id = $"sel-{Id}";
            }
            Select2 select2 = new Select2(_dataAccessor, id);

            if (Placeholder.IsPresent())
            {
                select2.SetPlaceholder(Placeholder);
            }
            if (SourceList != null)
            {
                select2.SetDataSource(SourceList);
            }
            if (SelectModel != null)
            {
                select2.SetSelect2Mode(SelectModel);
            }
            if (IsMulti)
            {
                select2.SetMultiSelectAble(IsMulti);
            }
            if (DefaultValue.IsPresent())
            {
                select2.SetDefaultValue(DefaultValue);
            }
            if (OnChange.IsPresent())
            {
                select2.SetChangeEvent(OnChange);
            }
            if (Width > 0)
            {
                select2.SetWidth(Width);
            }
            output.Content.AppendHtml(select2.ToString());
        }