Oct 01 2006
Using Enums to drive DropDownLists
Mark came up with an idea to use Enums to drive lookups. I told him I could go one better by providing user-friendly names instead of programmer-friendly enum value names. The idea is to loop through the literal fields of the enum type and check for a DescriptionAttribute on each field. Anyway, here’s the source, with caching for top performance.
Related posts

























not only perfected but optimised and full of 2.0 goodness
Nice one!
Very nice, but not quite perfect as you could:
1) Remove the extra namespaces
using System.Web.UI.WebControls;
using System.Collections.Generic;
2) Seal the class
public sealed class EnumDataSource
I’m using the current class, so I thought it would fair to post the changes I made to the class.
Nit picking, I had to add my 2 cents.
Cheers.
sorry about that, got posted the wrong namespace
should have been:
using System.ComponentModel
using System.Web.UI.WebControls.
Cheers