I have a repeater that has an OnItemDataBound event on it. For some reason the repeater has three items being bound to it. But then I try the below it only writes ‘2’ at the top of the page. The repeater itself does show the three items but this loop in the OnDataBound event doesn’t see the last item. Why?
protected void colourRepeater_ItemBound(object sender, RepeaterItemEventArgs e)
{
int count = 0;
foreach (RepeaterItem item in rptAssoicatedProducts.Items)
{
count++;
}
Response.Write(count.ToString());
}
Try this instead :
EDIT:
When the
ItemDataBoundevent is triggered, theRepeaterItemis not linked to theRepeateryet … only the related data is.