Home - Forums-.NET - FlyTreeView (ASP.NET) - Tree not found when added to custom control

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

Tree not found when added to custom control
Link Posted: 10-May-2007 20:26
Hello:

I have a custom WebControl that renders an asp panel.  Within that panel, I add a FlyTreeView.  This is all done programmatically without any UI.  When I add a populate on demand node, the runtime JavaScript error I receive is the following:

Error when performing server call back:
The target '$' for the callback could not be found or did not implement ICallbackEventHandler.


This occurs when clicking the populate on demand node.  The interesting thing is that the name of the id of the tree is getting rendered with the _ instead of the $ as the default delimiter within my control.  I am implementing the INamingContainer interface.  Any ideas on what I am doing wrong?

Thanks,

Jamey
Link Posted: 11-May-2007 00:22
The ASP.NET framework cannot find control.

Do you add FlyTreeView control in the OnInit stage of your webcontrol life cycle?
Link Posted: 11-May-2007 04:32
Hmmm, no, I am creating it in the CreatechildControls().  That is what this post said to do: http://www.9rays.net/forums/viewtopic.php?t=1201&highlight=createchildcontrols&sid=2d931f67806b11d0f9f48bdee8fe599c

Should I use the OnInit instead?
Link Posted: 11-May-2007 04:39
Yes, CreatechildControls is better.

So the sample here (the last one):
http://www.9rays.net/forums/viewtopic.php?t=1201&highlight=createchildcontrols&sid=2d931f67806b11d0f9f48bdee8fe599c

includes custom control with populate on demand and works as it should.
Link Posted: 14-May-2007 04:40
I see.  The issue is that I am creating the control and the tree dynamically in the code behind.  The page does not always have the tree within its controls.  As a result, in order for the dynamic population to function, I need to run through the logic to recreate the control on Post Back.  Otherwise the object does not exist for the event that is being fired and the control cannot be found.  Okay, got that.  

The one question I do have is... I have a tree where I set nodes to be populated on demand.  I have an event... ftv_PopulateNodes(object sender, FlyTreeNodeEventArgs e), that gets wired up to these events.  My question is, when I dynamically expand a node, is there a way to get the information that would be FlyTreeNodeEventArgs e on the Page_Load event?  Or more importantly, is there something in the postback, before the ftv_PopulateNodes event fires that would tell me what tree and/or node was clicked?  Knowing this information before the ftv_PopulateNodes fired would save me a bit of logic on Post Back.    

Thanks!!
Link Posted: 14-May-2007 10:31
There is a way to get value indicating whether FlyTreeView performs callback (populates on demand).

Like this:

bool treeviewCallback = IsCallBack && Request[\"__CALLBACKID\"] == flyTreeView.UniqueID;



So this code simply checks request parameter coming from client side.
If it equals to UniqueID of flytreeview instance then it comes from flytreeview.