Search results

Form Submit in ASP.NET Core ListBox control

In the following code snippet, the value that is in selected state will be sent on form submit.

tagHelper
formsubmit.cs
<form>
    <ejs-listbox id="listbox" dataSource="@ViewBag.data"></ejs-listbox>
    <ejs-button id="button" isPrimary="true" content="Submit"></ejs-button>
</form>
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 formsubmit()
        {
            ViewBag.data = 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();
        }
    }
}