Search results

Select Items in ASP.NET MVC ListBox control

14 Apr 2021 / 1 minute to read

In the following example, Bugatti Chiron is selected using selectItems method.

Copied to clipboard

    function create() {
        var listboxobj = document.getElementById("listbox").ej2_instances[0];
        listboxobj.selectItems(['Bugatti Chiron'])
Copied to clipboard
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 selectitem()
   = new string[] { "BadmHennessey Venominton", "Bugatti Chiron", "Bugatti Veyron Super Sport", "SSC Ultimate Aero", "Koenigsegg CCR", "McLaren F1", "Aston Martin One- 77", "Jaguar XJ220" };
            return View();