This code here demonstrates the 4 things, populating an array. Assigning the values of the array to a data source and binding the array. Lastly displaying the results on a web page. You can copy and paste the code to test it out.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
ArrayList arList = new ArrayList();
for(int k=0; k < 5; k++)
{
arList.Add("<br />Item " + k + " ");
}
arValList.DataSource = arList;
arValList.DataBind();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Repeating Items in ASP.NET</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Repeater ID="arValList" runat="server">
<HeaderTemplate>
<strong>This is a list of the array values.</strong>
</HeaderTemplate>
<ItemTemplate>
<%# Container.DataItem %>
</ItemTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>