I’m creating a navigation menu. I’ve to render repeater control ul-li tags and menuitems can range upto N levels. I need to add a child repeater control dymnamically to parent control?
EDIT:
Example –
ul-li can goto n levels
<ul>
<li>
<ul>
<li>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</li>
<li></li>
<li></li>
</ul>
</li>
<li></li>
<li></li>
</ul>
The repeater is not really designed for N nesting. The main problem is that you’d be creating them in the ItemDataBound event, and it would get messy trying to declare new event handlers for new controls.
The best thing is to use the Tree control.
Alternatively, if you really need to specify your template declarative, that is, define it in the aspx, then write your own control, which exposes templates for “nodes”, but behaves like exactly like a Tree control.