This is a migrated thread and some comments may be shown as answers.

Clear Global NodeTemplate

1 Answer 34 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Cliff Leighton
Top achievements
Rank 1
Cliff Leighton asked on 12 Jul 2009, 01:18 PM
I have a basic global NodeTemplate defined at Design time which I would like to apply to only top level nodes. I try to set the child nodes' NodeTemplate = null on code behind in Page_Load or Page_Init but it has no effect.

To work around this issue I've removed the global template and I'm loading the top level nodes' Controls collection dynamically at runtime.

Little help anyone?
Cliff

1 Answer, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 16 Jul 2009, 12:12 PM
Hi Cliff,

I'm afraid you will have to define your template controls in code behind and add them to the needed nodes, i.e.

    protected void Page_Load(object sender, EventArgs e) 
    { 
        foreach (RadTreeNode node in RadTreeView1.GetAllNodes()) 
        { 
            if (node.Level == 0) 
            { 
                Label lbl = new Label(); 
                lbl.Text = "this is a text"
                node.Controls.Add(lbl); 
            } 
        } 
    } 


Regards,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Cliff Leighton
Top achievements
Rank 1
Answers by
Paul
Telerik team
Share this question
or