I know that this is outside of the scope of PLINQO... However, it would be nice
if we had a DataSource Control that wrapped our generated enums so they could
be binded to controls declaratively.
Currently you need to use a collection and populate like this:
var names = Enum.GetNames(typeof(MyEnum));
var values = Enum.GetValues(typeof(MyEnum));
var list = new SortedDictionary<int, string>();
for (int index = 0; index < names.Length; index++)
{
list.Add((int)((MyEnum)values.GetValue(index)), names[index]);
}
DropDownList.DataTextField = "Value";
DropDownList.DataValueField = "Key";
DropDownList.DataSource = list;
DropDownList.DataBind();
Original issue reported on code.google.com by bniemyjski on 30 Sep 2010 at 2:27
Original issue reported on code.google.com by
bniemyjski
on 30 Sep 2010 at 2:27