Twitter <%=Resources.labels.subscribe %>

Enum as the data source for drop-down list - ASP.NET

  • I've been using enum's a lot lately. Here is another enum snippet for my snippet collection showing how to use an enum as the source for the items in a drop down.

    enum myEnum {Jan, Feb, Mar};

    DropDownList myDDL;

    myDDL.DataSource = Enum.GetNames( typeof ( myEnum ) );

    myDDL.DataBind();

    Tags:

    Permalink |

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading


Intro

My name is Brent Lamborn. I´m 35 years old and I live in Nebraska. I've been coding with the .NET Framework since 2003. I'm a former Marine and I have 5 boys.


View Brent Lamborn's LinkedIn profileView Brent Lamborn's profile

Sponsored By

Categories

Tag Cloud

Blog Roll