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 | using MvcExplorer.Models; using System.Collections.Generic; using System.Web.Mvc; namespace MvcExplorer.Controllers { public partial class ComboBoxController : Controller { private readonly ControlOptions _optionModel = new ControlOptions { Options = new OptionDictionary { { "Case Sensitive Search" , new OptionItem{ Values = new List< string > { "True" , "False" }, CurrentValue = "False" }} } }; public ActionResult Index(FormCollection collection) { IValueProvider data = collection; _optionModel.LoadPostData(data); ViewBag.DemoOptions = _optionModel; 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 | @ { List< string > countries = ViewBag.Countries; List< string > cities = ViewBag.Cities; ControlOptions optionsModel = ViewBag.DemoOptions; ViewBag.DemoSettings = true ; } < div > < label > @Html .Raw(Resources.ComboBox.Index_NonEditable)</ label > @ (Html.C1().ComboBox().Bind(countries).SelectedIndex(0).IsEditable( false ) .CaseSensitiveSearch(Convert.ToBoolean(optionsModel.Options[ "Case Sensitive Search" ].CurrentValue))) </ div > < div > < label > @Html .Raw(Resources.ComboBox.Index_Editable)</ label > @ (Html.C1().ComboBox().Bind(cities).SelectedIndex(0).IsEditable( true ) .CaseSensitiveSearch(Convert.ToBoolean(optionsModel.Options[ "Case Sensitive Search" ].CurrentValue))) </ div > @section Settings{ @Html .Partial( "_OptionsMenu" , optionsModel) } @section Description{ @Html .Raw(Resources.ComboBox.Index_Text0) < br /> @Html .Raw(Resources.ComboBox.CaseSensitiveSearchDescription_Text0) } |