Bind ArrayList to asp:dropdownlist (VB.net) : DropDownList « Data Binding « ASP.Net






Bind ArrayList to asp:dropdownlist (VB.net)

<%@Page language="vb" %>

<script runat="server" language="vb">
Sub Page_Load()
    Dim AnimalArrayList as new ArrayList()
    AnimalArrayList.Add("Dog")
    AnimalArrayList.Add("Cat")
    AnimalArrayList.Add("Elephant")
    AnimalArrayList.Add("Lion")
    AnimalArrayList.Add("Cat")
    MyDropDownList.DataSource = AnimalArrayList
    MyDropDownList.DataBind()
End Sub
</script>

<html>
<form id="Form1" method="post" runat="server">
<asp:dropdownlist id="MyDropDownList" runat="server" />
</form>
</html>

           
       








Related examples in the same category

1.Bind Color name to asp:dropdownlist (VB.net)
2.Bind DataTable to asp:DropDownList (VB.net)
3.Bind Hashtable to DropDownList (VB.net)
4.ArrayList Data binding for asp:DropDownList (VB.net)
5.Bind arraylist elements to asp dropdown and get selected one (VB.net)
6.Use ArrayList to fill dropdown value (C#)