Home - Forums-.NET - FlyTreeView (ASP.NET) - ontentContainer NineRays.WebControls.FlyTreeNode

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

ontentContainer NineRays.WebControls.FlyTreeNode
Link Posted: 28-Jan-2008 15:17
First of all, thank you for the prompt response to my prevous inquirey. I was quite impressed. Now I have a different question.

I would like to dynamically load a tree view with the user controls. So if somebody selects lets say ID=3, I would like to load a tree view, expand to that node and populate the user control in that node using that ID=3. I cannot find the obvious answer, because ContentContainer of the node is set to nothing (null), and every attempt of loading the usercontrol end’s up in null exception. I have tried overriding on prerender, but the error was still there (ContentContainer still null). Is there a way to do this? Where do you create ContentContainer and populate it with ContentTemplate? Which event handler should I override?

Cheers

S
Link Posted: 28-Jan-2008 18:59
May this will help you

http://www.9rays.net/asp.net_2/treeview/Demo_ServerTemplates.aspx

Which type of controls you want to load inside a node?
Link Posted: 28-Jan-2008 20:28
Thx for the reply, but it does not fix the problem.

We are testing with the usercontrol (ascx) and for example, I need to change the bgcolor of the control based on the number passed in. It is OK when the tree has been binded. When that happens ContentContainer is not null, but if I am binding and if I am trying to perform something on the usercontrol inside the node using ContentContainer.Find..., it will throw null exception, because the ContentContainer is null. The question is, when does the ContentContainer gets created and which event comes after that, so that I can override the handler for that event and do what I need to do with the control inside the ContentContainer.

Cheers
Link Posted: 28-Jan-2008 21:40
The ContentContainer gets created only when a node has NodeTypeID set to NodeType that has nonempty ContentTemplate.
It means that in any case, you need to create a NodeType with ContentTemplate and assign it to nodes (through node.NodeTypeID, or automatically through nodetype.AutoApplyXXX attributes).
Link Posted: 28-Jan-2008 23:31
Thx for the reply

I am sorry, but it looks like we are running in the circle. If i try to access the component inside node data bound event handler(i am sorry, but I do not have access to the component on my home machine, hence I do not know the correct name, but you know what I am talking about), I get the null error exception, because ContentContainer is null. When I try to access the component from onPrerender event handler of the treeview parent control I get the error because ContentContainer is null. When I try to access the component in the postback (no data binding), then it works.

The question is which event can I use to access ContentContainer during initial databinding of the treeview?
Link Posted: 28-Jan-2008 23:47
Try the FlyTreeView.NodeDataBound event.
Link Posted: 29-Jan-2008 00:00
Hm, I've just checked the NodeDataBound event, it does not seem to work correctly in the case.
Now I'll go deeply in the issue. This will take a while.
Link Posted: 29-Jan-2008 00:35
Anyway, please try the NodeDataBound event, it works in most cases.