?
Solved

Fill DropDownList from an enum

Posted on 2007-11-30
2
Medium Priority
?
2,185 Views
Last Modified: 2008-02-01
//Available via App_Code folder to all web pages...
    public enum PeriodTypes
    {
        Monthly = 1,
        Weekly,
        Daily,
        Yearly,
        BiYearly
    }

Can I fill a DropDownList using this enum, either by looping or straight assignment?

If I delete, modify, or add to the enum ... would the drop down list pick up the change?

And is it a "good idea" to do it that way? Or am I asking for trouble down the road?
0
Comment
Question by:Tom Knowlton
2 Comments
 
LVL 16

Accepted Solution

by:
anoyes earned 2000 total points
ID: 20385328
http://geekswithblogs.net/jawad/archive/2005/06/24/EnumDropDown.aspx
http://forums.asp.net/p/916237/1040004.aspx

In this case it'd be Enum.GetNames(typeof(PeriodTypes))

The drop down should pick up the change so long as you re-compile after the change (assuming you deploy by pre-compiling).
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Loops Section Overview
Suggested Courses
Course of the Month16 days, 15 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question