In this article I will explain with an example, how to populate (bind) DropDownList from Enum in ASP.Net using C# and VB.Net.
The Enum values will be extracted into an Array and then each Array item will be added to the ASP.Net DropDownList using C# and VB.Net.
HTML Markup
The following HTML Markup consists of an ASP.Net DropDownList and a Button control.
<asp:DropDownList ID="ddlColors" runat="server">
<asp:Button runat="server" Text="Submit" OnClick="OnSubmit" />
Following Enum consists of 3 Colors i.e. Red, Green and Blue to which the values are set to 1, 2 and 3 respectively.
public enum Colors
    Red = 1,
    Blue = 2,
    Green = 3
Public Enum Colors
    Red = 1
    Blue = 2
    Green = 3
End Enum
Populating (Binding) DropDownList from Enum in ASP.Net
Inside the Page Load event handler, the values of the Enum are fetched into an Array and then a loop is executed over the Array items and one by one each item is added to the DropDownList.
protected void Page_Load(object sender, EventArgs e)
    if (!this.IsPostBack)
        Array colors = Enum.GetValues(typeof(Colors));
        foreach (Colors color in colors)
            ddlColors.Items.Add(new ListItem(color.ToString(), ((int)color).ToString()));
       ddlColors.Items.Insert(0, newListItem("--Select Color--", ""));
Protected Sub Page_Load(sender As Object, e As EventArgsHandles Me.Load
    If Not Me.IsPostBack Then
        Dim colors As Array = [Enum].GetValues(GetType(Colors))
        For Each color As Colors In colors
            ddlColors.Items.Add(New ListItem(color.ToString(), CInt(color).ToString()))
       ddlColors.Items.Insert(0, New ListItem("--Select Color--", ""))
    End If
End Sub
Displaying selected Text and Value
When the Submit Button is clicked, following event handler is executed.
Inside this event handler, the selected text and value of DropDownList are fetched.
Finally, the fetched text and value are displayed using JavaScript Alert Message Box using the RegisterClientScriptBlock function.
protected void OnSubmit(object sender, EventArgs e)
    if (!string.IsNullOrEmpty(ddlColors.SelectedItem.Value))
        string color = ddlColors.SelectedItem.Text;
        string id = ddlColors.SelectedItem.Value;
        ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('" + "Color: " + color + "\\nID: " + id + "')", true);
Protected Sub OnSubmit(ByVal sender As Object, ByVal e As EventArgs)
    If Not String.IsNullOrEmpty(ddlColors.SelectedItem.Value) Then
        Dim color As String = ddlColors.SelectedItem.Text
        Dim id As String = ddlColors.SelectedItem.Value
        ClientScript.RegisterClientScriptBlock(Me.GetType(), "alert", "alert('" & "Color: " & color & "\nID: " & id & "')", True)
    End If
End Sub
Populate (Bind) DropDownList from Enum in ASP.Net using C# and VB.Net