Ejemplo n.º 1
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            Value        = TagHelperTools.FirstLetterToLower(Value);
            OptionsValue = TagHelperTools.FirstLetterToLower(OptionsValue);
            Options      = TagHelperTools.FirstLetterToLower(Options);
            OptionsText  = TagHelperTools.FirstLetterToLower(OptionsText);

            Id = Id == null?TagHelperTools.GetID() : Id;

            if (IsFormControl)
            {
                output.TagName = "div";
                output.Attributes.Add("class", $"form-group-sm col-md-{Col}");
                output.TagMode = TagMode.StartTagAndEndTag;
            }

            if (WithLabel)
            {
                template += $"<label class='control-label'>{Label}</label>";
            }

            template += $"<select class='form-control show-tick input-sm' data-style='btn btn-info btn-sm' data-bind='selectPicker: {Value}, optionsText: \"{OptionsText}\", optionsValue : \"{OptionsValue}\",  selectPickerOptions: {{ optionsArray: {Options} }}'></select>";

            output.Content.SetHtmlContent(template);
        }
Ejemplo n.º 2
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            Input = TagHelperTools.FirstLetterToLower(Input);
            Id    = Id == null?TagHelperTools.GetID() : Id;

            if (IsFormControl)
            {
                output.TagName = "div";
                output.Attributes.Add("class", $"form-group-sm col-md-{Col}");
                output.TagMode = TagMode.StartTagAndEndTag;
            }

            template += $"<label class='control-label'>{Label}</label>";
            template += $"<input class='form-control' data-bind='value: {Input}'></input>";

            output.Content.SetHtmlContent(template);
        }
Ejemplo n.º 3
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            Value = TagHelperTools.FirstLetterToLower(Value);
            Id    = Id == null?TagHelperTools.GetID() : Id;

            //Array OptionsArray = System.Enum.GetValues(EnumType);


            var enumVals = new List <object>();

            foreach (var item in Enum.GetValues(EnumType))
            {
                enumVals.Add(new
                {
                    id   = (int)item,
                    name = item.ToString()
                });
            }

            string Options = JsonConvert.SerializeObject(enumVals);

            if (IsFormControl)
            {
                output.TagName = "div";
                output.Attributes.Add("class", $"form-group-sm col-md-{Col}");
                output.TagMode = TagMode.StartTagAndEndTag;
            }

            if (WithLabel)
            {
                template += $"<label class='control-label'>{Label}</label>";
            }

            template += $"<select class='selectpicker form-control show-tick input-sm' data-style='btn btn-info btn-sm' multiple='true' data-bind='selectedOptions: {Value}, optionsText: \"name\", optionsValue : \"id\", options: {Options}'></select>";

            output.Content.SetHtmlContent(template);
        }