Solved

Fill DropDownList from an enum

Posted on 2007-11-30
2
2,175 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:knowlton
2 Comments
 
LVL 16

Accepted Solution

by:
anoyes earned 500 total points
Comment Utility
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
 
LVL 5

Author Comment

by:knowlton
Comment Utility
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now