Clear Global NodeTemplate

2 posts, 0 answers
  1. Cliff Leighton
    Cliff Leighton avatar
    1 posts
    Member since:
    Nov 2006

    Posted 12 Jul 2009 Link to this post

    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
  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 16 Jul 2009 Link to this post

    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.
Back to Top