I have an ASP.NET page with a drop down (asp:DropDownList) control. I also have a defined ENUM
Public Enum myEnumType As Integer
A
B
C
End Enum
I want to define the "value" property of each asp:ListItem with one of the ENUM value (A,B,C represented as a string of course). I also want to assign the "text" value of each to be some unrelated string (e.g "dog","cat","ant").
I would like to use this syntax:
<asp:DropDownList ID="myCombo" runat="server">
<asp:ListItem Text="cat" Value="<%= myEnumType.A.toString() %>" />
<asp:ListItem Text="dog" Value="<%= myEnumType.B.toString() %>" />
<asp:ListItem Text="ant" Value="<%= myEnumType.C.toString() %>" />
</asp:DropDownList>
But using the <%= is not valid in this type of controls.
How can I do this in declarative ASP.NET (not with code behind to create each item)