Hi
I want to specify a value for each option in the my select list box but I am generating it with an html helper.
So I have this
<%= Html.DropDownList("DropDownList") %>
// controller
ViewData["DropDownList"] = new SelectList(MyClass.GenerateListBox());
// MyClass
public static List<string> GenerateListBox()
{
List<string> listBox= new List<string>();
listBox.Add("Bye");
listBox.Add("hi");
listBox.Add("something");
return listBox;
}
So I see that SelectList has a "stringDataField" but it is only a stringnot a list so now really sure what I have to change.
Do I have to make some sort of other list?
Thanks