Home - Forums-.NET - FlyTreeView (ASP.NET) - Getting at controls that are added to the conten template

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

Getting at controls that are added to the conten template
Link Posted: 19-Jul-2006 13:02
    
            
                
                    
                
                
                    
                
                
                    
                        
                        
                    
                
            
    


I need to progamaticly get access to  a given node and then to its child controls .  in my example I have a nodetype called gender. it has two controls a label and a imagebutton.  I need to get at both controls when I'm dynamicly creating the node to set values.  Can this be done and if so how.
Link Posted: 20-Jul-2006 01:48
Probably you should use the FlyTreeNode.ContentContainer property to get the container control of every node.
The FlyTreeNode.ContentContainer is a control and thus has the FindControl method and the Controls collection property.
Link Posted: 20-Jul-2006 05:01
Tried that but the ContentContainer is null.  I'm creating a new node setting the node type and trying to set the CommandArgument property of an ImageButton within the node type content template.  Any other suggestions?
Link Posted: 23-Jul-2006 07:55
We should experiment with your code here. It'll take some time. Sorry for delay.
Link Posted: 23-Jul-2006 19:35
Ronald,

It seems to work here. But there might be some extra reasons.

Could you please provide some additional code on the way you bind the treeview and get access to ContentContainer.
I've managed to create a page with the following code:
    OnSelectedNodeChanged=\"ftv_SelectedNodeChanged\">
    
        
            
        
        
    
    
        
            
                
            
        
    
    


And the handler:
protected void ftv_SelectedNodeChanged(object sender, SelectedNodeChangedEventArgs e)
{
    Control control = ftv.Nodes[1].ContentContainer.FindControl(\"myLabel\");
}