Inset element to ArrayList by index (C#)
<%@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");
AnimalArrayList.Add("Platypus");
AnimalArrayList.Insert(1,"Chicken");
AnimalArrayList.Remove("Cat");
AnimalArrayList.RemoveAt(0);
MyDropDownList.DataSource = AnimalArrayList;
MyDropDownList.DataBind();
}
</script>
<html>
<form id="Form1" method="post" runat="server">
<asp:dropdownlist id="MyDropDownList" runat="server" />
</form>
</html>
Related examples in the same category