Solved

Fill DropDownList from an enum

Posted on 2007-11-30
2
2,178 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
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
 
LVL 5

Author Comment

by:knowlton
ID: 20385349
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
daypilot scheduler 3 35
ASP.net File format issue in producing Excel file 3 49
Code works but breaks when I add one section 4 20
How to filter by key press ? 6 23
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

861 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