Sort array reversely (C#)
<%@Page Language="c#" %>
<script runat="server" Language="c#">
void Page_Load()
{
string[] AnimalArray = new string[5]
{ "Dog", "Cat", "Elephant", "Lion", "Cat" };
Array.Reverse(AnimalArray);
foreach (string strAnimal in AnimalArray)
{
MyDropDownList.Items.Add(strAnimal);
}
}
</script>
<html>
<form id="Form1" method="post" runat="server">
<asp:dropdownlist id="MyDropDownList" runat="server" />
</form>
</html>
Related examples in the same category