@Html.DropDownList - set particular text at top to display
code:
@Html.DropDownList("Plant",ViewData["PlantList"] as SelectList, new {style="height: 29px;"})
The dropdownlist has five items from viewdata. They are one, two, three, four, five.
I am having another as viewdata["displaytext"]
.
Here any 1 value from the options will be present. say for example now three
is present in this viewdata
. How to set this three
to be display text
EDIT Adding controller method:
public ActionResult PlantList()
{
...
...
ViewData["PlantList"] = pList;
ViewData["displaytext"] = "three";
return view();
}