I'm creating a control that will mimic the functionality of a 'grouped repeater', whilst allowing them to define a template for each group header and another template for each group item.
My approach to this is to create a new class that has two public ITemplate members that will expose a way of defining the markup for these two templates on the page. I will then take the first template and assign it to the ItemTemplate of the 'parent repeater' and then the second template will be assigned to the ItemTemplate of the child repeater.
All fine so far.
Now I'm left with the problem of adding the child repeater to the ItemTemplate of the parent. A solution to this would be to add a control (possibly a placeholder) to the ItemTemplate of the parent repeater and then, on ItemDataBound, add the child repeater to the control collection of the placeholder, but I don't have this luxury as I cannot assume a PlaceHolder will be declared in the ItemTemplate on the page's markup.
I either need to:
A. Add the child repeater to the ItemTemplate of the parent repeater programmatically some other way (I don't know how)
or
B: Add a placeholder to the ItemTemplate of the parent repeater so that on ItemDataBound I can do what I need to do to get the child repeater in there
A suggestion of how I could achieve either of the two above solutions is what I'm after. Any help much appreciated.
I'm also open to alternative approaches if necessary.