Documentation > CMS Template API Library > Input > ShowDropDown(String,String,Dictionary[String,String],List[String],Int32,Boolean,String,String)

ShowDropDown

Shows a drop down menu selector control.

public System.Void ShowDropDown(String,String,Dictionary[String,String],List[String],Int32,Boolean,String,String)

Parameters

NameDescriptionType
label The label of the field when displayed. System.String
fieldName The field name where the value will be stored. System.String
entries A list of key/value pairs that define the entries in the list. Key is the text that is displayed, value gets stored. Dictionary<String,String>
defaultValue Optional: defaults to null. The list of default values that will appear selected when nothing has been selected. The size of this list can only be greater than 1 if and only if the optional parameter multiple is set to true. List<String>
size Optional: defaults to 1. This optional parameter sets the size parameter of the select tag. System.Int32
multiple Optional: defaults to false. Setting this optional parameter to true will allow multiple selections from the drop down menu. System.Boolean
helpMessage Optional: help message System.String
popupMessage Optional: The popup help message. System.String

Code Example

C#

Sample:
// The users will see Zero, One, and Two, but 0,1,2 will be stored as the value
Dictionary<string,string> entries = new Dictionary<string, string>(){{"Zero","0"},{"One","1"},{"Two","2"}};
Input.ShowDropDown("Nested Drop Down", "nested_drop", entries);

//The users will see English, French, Japanese, and Korean, but en, fr, jp, kr as the value
Dictionary<string, string> languages = new Dictionary<string, string>() { { "English", "en" }, { "French", "fr" }, { "Japanese", "jp" }, { "Korean", "kr" } };
Input.ShowDropDown("Language Settings", "language_setting", languages, Util.MakeList("en", "jp"), languages.count, true);

Connect with Crownpeak