Mega Code Archive

 
Categories / ASP.Net / Collections
 

Bind arrayList to asp

<%@Page Language="c#" %> <script runat="server" Language="c#">   void Page_Load()    {     ArrayList AnimalArrayList = new ArrayList();     AnimalArrayList.Add("Dog");     AnimalArrayList.Add("Cat");     AnimalArrayList.Add("Elephant");     AnimalArrayList.Add("Lion");     AnimalArrayList.Add("Cat");     MyDropDownList.DataSource = AnimalArrayList;     MyDropDownList.DataBind(); } </script> <html> <form id="Form1" method="post" runat="server">   <asp:dropdownlist id="MyDropDownList" runat="server" /> </form> </html>