Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.NET C# Databinding Enum

Posted on 2011-09-13
3
Medium Priority
?
390 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Assisted Solution

by:Minh Võ Công
Minh Võ Công earned 668 total points
ID: 36533559
0
 
LVL 7

Accepted Solution

by:
dimaj earned 668 total points
ID: 36533574
Try this:

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

Assisted Solution

by:nishant joshi
nishant joshi earned 664 total points
ID: 36533835
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

721 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