Use ArrayList to fill dropdown value (C#) : ArrayList « Collections « ASP.Net






Use ArrayList to fill dropdown value (C#)

<%@ Page Language="C#" Debug="true" %>
<script runat="server">

    void Page_Load()
    {
         ArrayList list = new ArrayList();
         list.Add("none");
         list.Add("Canada Post");
         list.Add("UPS");
    
         list.Insert(1,"FedEx");
    
         MyDropDownList.DataSource = list;
         MyDropDownList.DataBind();
    }

</script>
<html>
<head>
    <title>ArrayList Example</title>
</head>
<body>
    <form id="Form1" method="post" runat="server">
        <asp:dropdownlist id="MyDropDownList" runat="server"></asp:dropdownlist>
    </form>
</body>
</html>

           
       








Related examples in the same category

1.ArrayList: insert value by index (VB.net)
2.ArrayList: remove item (VB.net)
3.ArrayList: remove item by index (VB.net)
4.Use array and ArrayList (VB.net)
5.Bind arrayList to asp:dropdownlist (C#)
6.Inset element to ArrayList by index (C#)
7.Remove object from ArrayList (C#)
8.Remove object from ArrayList by Index (C#)