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