I have a repeater nested in the ItemTemplate
of a parent Repeater. I usually connect them to controls declaratively in markup.
<asp:Repeater runat='server' id='myParentRepeater'>
<ItemTemplate>
<asp:Repeater runat='server' id='mynestedRepeater' OnItemCommand='myMethod'>
...
</asp:Repeater>
...
</ItemTemplate>
</asp>
Today I decided to do it in the code-behind, specifically in the ItemDataBound
method of the parent repeater./
((Repeater)e.item.FindControl("MyParentRepeater")).ItemCommand += ...
But it won't work this way. Unless I use markup the event handler won't fire. Why is this? Or, assuming it should work, can someone tell me what have I done wrong?