Well, anything you can do in aspx you can also do programatically.
Take for instance the ListBox WebControl. You can add items in the
aspx file:
asp:ListBox id="ListBox1" runat="server" >
<asp:ListItem Value="1">item1s</asp:ListItem>
<asp:ListItem Value="2">item2</asp:ListItem>
</asp:ListBox>
Or you could add them programatically in the code behind:
ListBox1.Items.Add(new ListItem("item1", "1"));
ListBox1.Items.Add(new ListItem("item2", "2"));
or if you already have an array of ListItems declared, you can add
them all at once with the AddRange method.
If you already have an array or ArrayList of custom objects (with
public properties), you can use the use those objects as a DataSource.
HTH!