ComboBox
Overview
This sample shows the basic usage of the ComboBox control.
Features
Settings
Description
This sample shows the basic usage of the ComboBox control.
When Case Sensitive Search is true, the user types are searched as case-sensitive
When Case Sensitive Search is true, the user types are searched as case-sensitive
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using MvcExplorer.Models; using System.Collections.Generic; namespace MvcExplorer.Controllers { public partial class ComboBoxController : Controller { private readonly ControlOptions _options = new ControlOptions { Options = new OptionDictionary { { "Case Sensitive Search" , new OptionItem{ Values = new List< string > { "True" , "False" }, CurrentValue = "False" }} } }; private readonly C1NWindEntities _db; public ComboBoxController(C1NWindEntities db) { _db = db; } public ActionResult Index(IFormCollection collection) { _options.LoadPostData(collection); ViewBag.DemoOptions = _options; ViewBag.Countries = Countries.GetCountries(); ViewBag.Cities = Cities.GetCities(); return View(); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | @ { ControlOptions optionsModel = ViewBag.DemoOptions; ViewBag.DemoSettings = true ; List< string > countries = ViewBag.Countries; List< string > cities = ViewBag.Cities; } < div > < label > @Html .Raw(ComboBoxRes.Index_NonEditable)</ label > < c1-combo-box selected-index = "0" is-editable = "false" max-drop-down-width = "55" case-sensitive-search = "@Convert.ToBoolean(optionsModel.Options[" Case Sensitive Search "].CurrentValue)" > < c1-items-source source-collection = "@countries" ></ c1-items-source > </ c1-combo-box > </ div > < div > < label > @Html .Raw(ComboBoxRes.Index_Editable)</ label > < c1-combo-box selected-index = "0" is-editable = "true" case-sensitive-search = "@Convert.ToBoolean(optionsModel.Options[" Case Sensitive Search "].CurrentValue)" > < c1-items-source source-collection = "@cities" ></ c1-items-source > </ c1-combo-box > </ div > @section Settings{ @await Html.PartialAsync( "_OptionsMenu" , optionsModel) } @section Description{ @Html .Raw(ComboBoxRes.Index_Text0) < br /> @Html .Raw(ComboBoxRes.CaseSensitiveSearchDescription_Text0) } |