MultiAutoComplete
MultiAutoComplete
Overview
This sample shows the basic usage of the MultiAutoComplete control.
Features
Type in a country name
Albania×
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.
1 2 3 4 5 6 7 8 9 10 11 12 | using System.Web.Mvc; namespace MvcExplorer.Controllers { public partial class MultiAutoCompleteController : Controller { public ActionResult Index() { return View(Models.Countries.GetCountries()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | @model List< string > @section Styles{ < style > .highlight { background-color: #ff0; color: #000; } </ style > } < p > @Html .Raw(Resources.MultiAutoComplete.Index_Text0)</ p > @ (Html.C1().MultiAutoComplete().Bind(Model).CssMatch( "highlight" ) .SelectedIndexes(1) .MaxSelectedItems(4)) @section Summary{ @Html .Raw(Resources.MultiAutoComplete.Index_Text3) } @section Description{ < p > @Html .Raw(Resources.MultiAutoComplete.Index_Text1)</ p > < p > @Html .Raw(Resources.MultiAutoComplete.Index_Text2)</ p > } |