Recursive UserControls? Are they possible?

N

Nathan

I am trying to implement something similar to a treeview in an asp.net usercontrol. As this control has no need to allow multiple branches to be expanded at the same time the easiest way to do this would be to make a datalist where the selected item is identical to the item template with the addition of another instance of the same control embedded in it.
like this
mycontrol
item1
item2
mycontrol
item1
etc...

I cannot however find a way to do this. Doing so declaritively causes a circular reference. I can use loadcontrol in the codebehind, but I am having trouble adding it to the datalistitem properly.

I would think this would be a fairly common thing to do but all controls like this I have found are custom servercontrols. There must be a way to have a control contain instances of it's own class.

Any help would be greatly appreciated.
Thanks
Nathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,813
Messages
2,569,696
Members
45,483
Latest member
TedDvb6626

Latest Threads

Top