Hi
I have the following code:
foreach (SelectListItem item in selectListItems)
{
string tex = item.Text;
string val = item.Value;
string sel = item.Selected.ToString();
}
SelectList selectList = new SelectList(selectListItems);
foreach (SelectListItem slid in selectList)
{
string tex = slid.Text;
string val = slid.Value;
string sel = slid.Selected.ToString();
}
I'm extending an Enum and have left out the rest of the code for brevity. In a nutshell:
selectListItems has all the correct values for my Enum and is a generic List of SelectListItems. The first foreach loop works fine.
However, when I create my actual SelectList and pass in the selectListItems all the values are lost.
Can anyone help please?
Thanks