c# - get asp.net color names

Get asp.net color names
GetColorNameList.aspx

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Text" %>

<!DOCTYPE html>

<script runat="server">
    protected void Page_Load(object sender, System.EventArgs e) { 
        if(!this.IsPostBack)
        {
            string[] colorArray = Enum.GetNames(typeof(KnownColor));
            ListBox1.DataSource = colorArray;
            ListBox1.DataBind();
        }
    }

    protected void ListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        Label1.ForeColor = Color.FromName(ListBox1.SelectedItem.Text);
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to get color name list in asp.net</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Red">Get Color Name List</h2>
        <asp:Label 
             ID="Label1" 
             runat="server"
             Font-Bold="true"
             Font-Size="Larger"
             Text="Hi Jenny!"
             ForeColor="Black"
             >
        </asp:Label>
        <br /><br />
        <asp:ListBox 
             ID="ListBox1" 
             runat="server"
             BackColor="DodgerBlue"
             ForeColor="AliceBlue"
             AutoPostBack="true"
             OnSelectedIndexChanged="ListBox1_SelectedIndexChanged"            
             >
        </asp:ListBox>
    </div>
    </form>
</body>
</html>
More asp.net examples