Hello,
You can use a listview or a repeater.
<asp:ListView ID="lvData" runat="server" OnItemDataBound="lvData_ItemDataBound" DataKeyNames="ID">
<LayoutTemplate>
<div id="itemPlaceholder" runat="server"></div>
</LayoutTemplate>
<ItemTemplate>
<uc1:mycustomcontrol id="mycustomcontrol1" runat="server" />
</ItemTemplate>
</asp:ListView>
in the code behind we will asssign datasource to the listview from the page load method and later handle ItemDataBound Event of the listview to populate data for the customcontrol
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
IList dataSource=GetData();
lvData.DataSource=dataSource;
lvData.DataBind();
}
}
protected void lvData_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
ListViewDataItem dataItem = (ListViewDataItem)e.Item;
int id = int.Parse(lvData.DataKeys[dataItem.DataItemIndex].Values[0].ToString());
mycustomcontrol mycustomcontrol1 = e.Item.FindControl("mycustomcontrol1") as mycustomcontrol;
mycustomcontrol.refresh(id);
}
}