Search results

Custom Value in ASP.NET MVC MultiSelect control

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.

razor
customvalue.cs
<div id='local-data'>
    <div class='control-wrapper'>
        @Html.EJS().MultiSelect("default").Placeholder("Select games").AllowCustomValue(true).DataSource((IEnumerable<object>)ViewBag.data).Fields(new Syncfusion.EJ2.DropDowns.MultiSelectFieldSettings { Text = "Game", Value = "Id" }).Render()
    </div>
</div>
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();
        }
    }
}