View
<input type="hidden" name="selectedValue" value="0" />
<select name="itemType" id="itemType" style="width:80%;">
<option value="Item1">Item 1</option>
<option value="Item2">Item 2</option>
<option value="Item3">Item 3</option>
<option value="Item4">Item 4</option>
<option value="Item5">Item 5</option>
</select>
ViewModel
public ItemTypes itemType { get; set; }
Enum List in ItemTypes.cs (Extension Method)
public enum ItemTypes
{
Item1,
Item2,
Item3,
Item4,
Item5
}
public static string GetItemDesc(this ItemTypes itemtype)
{
switch (itemtype)
{
case ItemTypes.Item1:
return "Item 1 Description";
case ItemTypes.Item2:
return "Item 2 Description";
case ItemTypes.Item3:
return "Item 3 Description";
default:
return "Item 4 and 5 Description";
}
}
Above is my code. I would like to retain the selected Enum value throughout the page. I have four, The Index (where the drop down menu lives), the page where you select your payment method, the verification page, (where you verify all the information you put in) and the receipt page (to show that your transaction has been successful.) I need the enum value to remain the same through each page. Please help.