I was wondering how one would find the controls in the HeaderTemplate or FooterTemplate of an Asp.Net Repeater control.
I can access them on the ItemDataBound event,
The best and clean way to do this is within the Item_Created Event :
protected void rptSummary_ItemCreated(Object sender, RepeaterItemEventArgs e)
{
switch (e.Item.ItemType)
{
case ListItemType.AlternatingItem:
break;
case ListItemType.EditItem:
break;
case ListItemType.Footer:
e.Item.FindControl(ctrl);
break;
case ListItemType.Header:
break;
case ListItemType.Item:
break;
case ListItemType.Pager:
break;
case ListItemType.SelectedItem:
break;
case ListItemType.Separator:
break;
default:
break;
}
}
You can take a reference on the control on the ItemCreated event, and then use it later.