There are several things this sample shows, including creating an arraylist and binding it to a DropDownList, but the main thrust of the sample is to show how to easily change the background color of the existing page programmatically.
<html>
<head>
<meta name=”GENERATOR” Content=”ASP Express 2.0″>
<title>Change Body Color</title>
<script language=”VB” runat=”server”>
Sub Page_Load(Source as Object, E as EventArgs)
if not Page.IsPostBack then
Dim ColorList as ArrayList= new ArrayList()
ColorList.Add (“AliceBlue”)
ColorList.Add (“AntiqueWhite”)
ColorList.Add (“Aquamarine”)
ColorList.Add (“BlanchedAlmond”)
ColorList.Add (“CadetBlue”)
ColorList.Add (“Chocolate”)
dd1.datasource=ColorList
dd1.databind()
end if
End Sub
Sub changecolor(Source as Object, E as EventArgs)
bdy.attributes(“bgcolor”)=dd1.SelectedItem.Text
End Sub
</script>
</head>
<body runat=”server” id=”bdy”>
<Form id=”form1″ runat=”server”>
<asp:DropDownList id=”dd1″ runat=”server” /><asp:Button id=”button1″ Text=”Change Background Color” onclick=”changecolor” runat=”server” />
</Form>
</body>
</html>