I want a DropDownList that allows users to select a colour. I would like to add a coloured square to the dropdownlist item or colour the text the appropriate colour.
I am populating the DropDownList as in the code below:
Controller:
List<SelectListItem> colourSelectList = new List<SelectListItem>();
colourSelectList.Add(new SelectListItem() { Text = "Blue", Value = "blue" });
colourSelectList.Add(new SelectListItem() { Text = "Red", Value = "red" });
colourSelectList.Add(new SelectListItem() { Text = "Green", Value = "green" });
colourSelectList.Add(new SelectListItem() { Text = "Purple", Value = "purple" });
colourSelectList.Add(new SelectListItem() { Text = "Grey", Value = "grey" });
colourSelectList.Add(new SelectListItem() { Text = "Yellow", Value = "yellow" });
ViewData["ColourSelectList"] = colourSelectList;
View:
<div class="form-group">
<label class="col-md-3 control-label">Colour<span class="required"> * </span></label>
<div class="col-md-3">
@Html.DropDownListFor(m => m.MetronicBrandColour, ViewData["ColourSelectList"] as IEnumerable<SelectListItem>, " --- Select Colour --- ", new { @class = "form-control" })
</div>
</div>
All works as expected but I'd like the combobox to look like this mock up:
So, is it possible to do this or - just just set the font color somehow?

