MultiAutoComplete
MultiAutoComplete
Overview
This sample shows the basic usage of the MultiAutoComplete control.
Features
Sample
Type in a country name
Description
The MultiAutoComplete control allows users to pick items from lists that contain custom objects or simple strings.
In this sample, the MultiAutoComplete control uses a string array as its ItemsSource. The maximum number of token fields is set to 4.
Source
IndexController.cs
using Microsoft.AspNetCore.Mvc;
namespace MvcExplorer.Controllers
{
public partial class MultiAutoCompleteController : Controller
{
public ActionResult Index()
{
return View(Models.Countries.GetCountries());
}
}
}
Index.cshtml
@model List<string>
@section Styles{
<style>
.highlight {
background-color: #ff0;
color: #000;
}
</style>
}
<p>@Html.Raw(MultiAutoCompleteRes.Index_Text0)</p>
<c1-multi-auto-complete css-match="highlight" max-selected-items="4" selected-indexes="new List<int> { 1 }">
<c1-items-source source-collection="@Model"></c1-items-source>
</c1-multi-auto-complete>
@section Summary{
@Html.Raw(MultiAutoCompleteRes.Index_Text3)
}
@section Description{
<p>@Html.Raw(MultiAutoCompleteRes.Index_Text1)</p>
<p>@Html.Raw(MultiAutoCompleteRes.Index_Text2)</p>
}
Documentation