BeanSoftware Logo
 

 
ASP.NET Database Search Control
 
 

 
 Home
    Shop
    Advertise
    Write For Us
    Affiliate
    Newsletter
    Contact

How To Fill DropDownList Control With ArrayList?

You can fill DropDownList control with items of ArrayList control by using its DataSource property. One of solutions is code like this:

[ C# ]

// Create ArrayList alColors and populate it
// with some items
ArrayList alColors = new ArrayList();
alColors.Add("Red");
alColors.Add("Green");
alColors.Add("Yellow");
alColors.Add("Blue");
// Show ArrayList items in DropDownList named ddlColors
ddlColors.DataSource = alColors;
ddlColors.DataBind();

[ VB.NET ]

' Create ArrayList alColors and populate it
' with some items
Dim alColors As ArrayList = New ArrayList()
alColors.Add("Red")
alColors.Add("Green")
alColors.Add("Yellow")
alColors.Add("Blue")
' Show ArrayList items in DropDownList named ddlColors
ddlColors.DataSource = alColors
ddlColors.DataBind()



Related articles:

1. Export Crystal Reports to PDF file

FAQ toolbar: Submit FAQ  |  Tell A Friend  |  Add to favorites  |  Feedback



Copyright © 2002-2008 Bean Software. All rights reserved.