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): 49943/ 117

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

User Comments

Title: Great   
Name: Suraj
Date: 2008-12-04 1:30:52 AM
Comment:
great helped immensly
Title: Great   
Name: Willy AF
Date: 2008-02-02 10:01:36 PM
Comment:
Great work, I will wait for the next trick, Very helpful,,,
Thanks
Title: Greate tips   
Name: nguyen letan
Date: 2008-02-02 7:31:09 AM
Comment:
Your article is very helpful for me. Thanks!
Title: Great Trick   
Name: s.k.shivaprasad
Date: 2008-01-31 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: 2007-12-10 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: 2007-12-05 3:42:07 AM
Comment:
Very helpful link. Thanks.
Title: Great Trick   
Name: Brendan
Date: 2007-12-04 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.






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


©Copyright 1998-2017 ASPAlliance.com  |  Page Processed at 2017-06-28 4:51:14 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search