Enable or disable items

17 Feb 20222 minutes to read

To enable or disable items in the list box, enableItems method can be used. In the following example, the Bugatti Veyron Super Sport and SSC Ultimate Aero items are disabled by default and by clicking Enable Items buttons, the disabled items will be enabled.

<button class="e-btn" id="enableitem">Enable Items</button>

    var disableItems = ['Bugatti Veyron Super Sport', 'SSC Ultimate Aero'];
    function create() {
        var listboxobj = document.getElementById("listbox").ej2_instances[0];
        listboxobj.enableItems(disableItems, false);

    document.getElementById('enableitem').onclick = function () {
        var listboxobj1 = document.getElementById("listbox").ej2_instances[0];
        listboxobj.enableItems(disableItems, true);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WebApplication1.Models;

namespace WebApplication1.Controllers
    public class ListBoxController : Controller
        public IActionResult enableitem()
            ViewBag.data = new string[] { "BadmHennessey Venominton", "Bugatti Veyron Super Sport", "SSC Ultimate Aero", "Bugatti Chiron", "Koenigsegg CCR", "McLaren F1", "Aston Martin One- 77", "Jaguar XJ220" };
            return View();