Return array from collection to bind to dropdownlist

Posts   
 
    
DrM
User
Posts: 49
Joined: 09-Feb-2004
# Posted on: 05-Jul-2005 11:26:05   

Is there any method that will allow me to easily bind a collection to an ASP.NET dropdownlist. Any tips from ASP.NETters that do this frequently. At the moment I'm using a generic routine to loop through the collection and add the items to the dropdownlist one by one. Feels kinda last century to me.

Posts: 112
Joined: 09-Aug-2004
# Posted on: 05-Jul-2005 18:51:02   

DropDownList.DataMember = "Field To Show"; DropDownList.DataValueMember = "UniqueID"; DropDownList.DataSource = collection;