Extending the DropDownList to Support Enums
page 1 of 6
Published: 04 Dec 2007
Abstract
In this article, Steve demonstrates how to bind a DropDownList to an Enum type, and then goes on to create a generic EnumDropDownList control which will automatically display any enum type's contents.
by Steven Smith
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 15225/ 209

Introduction

A fairly common task in some of the applications I work with is to provide a user with a DropDownList of options that is populated by an enum.  This can easily be done with a little bit of code to bind a stock DropDownList control to the enum, but this kind of thing quickly starts to violate the DRY (Don't Repeat Yourself) principle, so I created a simple derived DropDownList control that takes advantage of Generics to make it especially effective and require less code and casting of data types.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 1 and 4 and type the answer here:

User Comments

Title: Great   
Name: Suraj
Date: 12/4/2008 1:30:52 AM
Comment:
great helped immensly
Title: Great   
Name: Willy AF
Date: 2/2/2008 10:01:36 PM
Comment:
Great work, I will wait for the next trick, Very helpful,,,
Thanks
Title: Greate tips   
Name: nguyen letan
Date: 2/2/2008 7:31:09 AM
Comment:
Your article is very helpful for me. Thanks!
Title: Great Trick   
Name: s.k.shivaprasad
Date: 1/31/2008 4:47:50 AM
Comment:
Great work. I spent a lot of time trying to figure this out myself. It is kind of annoying that ASP.NET doesn't support declared generic controls. That would be a great improvement.good...
Title: Great Article   
Name: Joydip
Date: 12/10/2007 12:39:26 PM
Comment:
Hi Steve, this is an excellent article. This will help the readers a lot. Awesome!

Thanks,

Joydip

Author, Data Presentation Controls Essentials (PacktPub)
Title: Really useful   
Name: Uday D
Date: 12/5/2007 3:42:07 AM
Comment:
Very helpful link. Thanks.
Title: Great Trick   
Name: Brendan
Date: 12/4/2007 9:53:13 AM
Comment:
Great work. I spent a lot of time trying to figure this out myself. It is kind of annoying that ASP.NET doesn't support declared generic controls. That would be a great improvement.

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 1/7/2009 8:30:31 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search