Use ArrayList to fill dropdown value (C#) : DropDownList « Data Binding « 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.Bind Color name to asp:dropdownlist (VB.net)
2.Bind DataTable to asp:DropDownList (VB.net)
3.Bind ArrayList to asp:dropdownlist (VB.net)
4.Bind Hashtable to DropDownList (VB.net)
5.ArrayList Data binding for asp:DropDownList (VB.net)
6.Bind arraylist elements to asp dropdown and get selected one (VB.net)