Solved

ASP.NET C# Databinding Enum

Posted on 2011-09-13
3
373 Views
Last Modified: 2012-05-12
is it possible to databind the values af an Enum?

Something like this:

public enum BlahEnum
    {  
        Red,
        Green,
        Blue,
        Purple
    }


this.ComboBox2.DataSource = BlahEnum;
this.ComboBox2.DataBind();

abd the combobox displays the item values like Red, Green, Blue, Purple
0
Comment
Question by:conrad2010
3 Comments
 
LVL 15

Assisted Solution

by:Minh Võ Công
Minh Võ Công earned 167 total points
Comment Utility
0
 
LVL 7

Accepted Solution

by:
dimaj earned 167 total points
Comment Utility
Try this:

comboBox1.DataSource = Enum.GetNames(typeof(BlahEnum));
0
 
LVL 14

Assisted Solution

by:nishant joshi
nishant joshi earned 166 total points
Comment Utility
public enum BlahEnum
{
    Today,
    Last7
    Last14,
    Last30,
    All
}

ComboBox combo = new ComboBox();

combo.DataSource = Enum.GetValues(typeof(BlahEnum));





http://www.codeproject.com/KB/cs/enumdatabinding.aspx

this might helps for more detail...
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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