using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
namespace
Repeater
{
public partial class RepeaterExample2 : System.Web.UI.Page
{
ArrayList arrProducts = new ArrayList();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GenerateArrayList();
ShowProducts();
}
}
private void ShowProducts()
{
rptProducts.DataSource
= arrProducts;
rptProducts.DataBind();
}
private void GenerateArrayList()
{
Product objProduct;
for (int i = 0; i < 6; i++)
{
objProduct = new Product();
objProduct.ProductID
= 100 + i.ToString();
objProduct.Description
= "Product " + (i + 1).ToString();
objProduct.Price
= 3.5 * (i + 1);
objProduct.QOH
= 5 * (i + 1);
arrProducts.Add(objProduct);
}
}
}
}