Search results

Custom Value in ASP.NET Core MultiSelect control

30 Jul 2021 / 1 minute to read

The MultiSelect allows user to add a new non-present option to the control value when allowCustomValue is enabled. while selecting the new custom value customValueSelection event will be triggered.

The following sample demonstrates configuration of custom value support with the MultiSelect control.

tagHelper
customvalue.cs
Copied to clipboard
<ejs-multiselect id="games" dataSource="@ViewBag.data" placeholder="Favorite Sports" allowCustomValue="true" mode="Default">
        <e-multiselect-fields value="Id" text="Game"></e-multiselect-fields>
</ejs-multiselect>
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 MultiSelectController : Controller
    {
        public ActionResult customvalue()
        {
            ViewBag.data = new GameList().GameLists();
            return View();
        }
    }
}