Search results

Disable the Fixed group header in DropDownList in ASP.NET Core DropDownList control

21 Jun 2021 / 1 minute to read

The following example demonstrate about how to disable the Fixed group header in DropDownList through CSS by using visibility attribute.

tagHelper
Vegetables.cs
Copied to clipboard
<div class="col-lg-12 control-section">
    <div id='groupList' class='col-lg-6' style='padding-top:15px'>
        <div class='content'>
            <ejs-dropdownlist id="vegetables" placeholder="Select a vegetable" popupHeight="200px" dataSource="@ViewBag.data">
                <e-dropdownlist-fields groupBy="Category" text="Vegetable" value="Id"></e-dropdownlist-fields>
            </ejs-dropdownlist>
        </div>
    </div>
    <div id='iconList' class='col-lg-6' style='padding-top:15px'>
    </div>
</div>
<style>
    .e-ddl .e-dropdownbase .e-fixed-head {
        visibility: hidden;
    }
</style>
Copied to clipboard
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApplication1.Models
{
    public class Vegetables
    {
        public string Vegetable { get; set; }
        public string Category { get; set; }
        public string Id { get; set; }
        public List<Vegetables> VegetablesList()
        {
        List<Vegetables> veg = new List<Vegetables>();
        veg.Add(new Vegetables { Vegetable = "Cabbage", Category= "Leafy and Salad", Id= "item1" });
        veg.Add(new Vegetables { Vegetable = "Chickpea", Category= "Beans", Id= "item2" });
        veg.Add(new Vegetables { Vegetable = "Garlic", Category= "Bulb and Stem", Id= "item3" });
        veg.Add(new Vegetables { Vegetable = "Green bean", Category= "Beans", Id= "item4" });
        veg.Add(new Vegetables { Vegetable = "Horse gram", Category= "Beans", Id= "item5" });
        veg.Add(new Vegetables { Vegetable = "Nopal", Category= "Bulb and Stem", Id= "item6" });
        veg.Add(new Vegetables { Vegetable = "Onion", Category= "Bulb and Stem", Id= "item7" });
        veg.Add(new Vegetables { Vegetable = "Pumpkins", Category= "Leafy and Salad", Id= "item8" });
        veg.Add(new Vegetables { Vegetable = "Spinach", Category= "Leafy and Salad", Id= "item9" });
        veg.Add(new Vegetables { Vegetable = "Wheat grass", Category= "Leafy and Salad", Id= "item10" });
        veg.Add(new Vegetables { Vegetable = "Yarrow", Category = "Leafy and Salad", Id = "item11" });
         return veg;
        }
    }
}