Question: 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)

Answer: 
The code doesn't make much sense. Why do you use Enum in this case? It's the same like using constants. It looks like you can get away with hard coding values.

```
<asp:DropDownList ID="myCombo" runat="server">
  <asp:ListItem Text="cat" Value="A" />
  <asp:ListItem Text="dog" Value="B" />
  <asp:ListItem Text="ant" Value="C" />
</asp:DropDownList>

```
Why not databind?

```
enum MyFavoriteEnum { A=1, B=2, C=3 }
for(int i =0; i<Enum.GetNames(typeof(MyFavoriteEnum)).Length;i++)
{
   ListItem li = new ListItem(
       Enum.GetNames(typeof(MyFavoriteEnum))[i],
       ((int)Enum.GetValues(typeof(MyFavoriteEnum)).GetValue(i)).ToString()
       );
    dropDown.Items.Add(li);
} 
// Edited to make it actually work

```