You must Sign In to post a response.
  • Category: .NET

    Dynamic Treeview nodes in Asp.net C#

    Hi Guys,

    I have a treeview in masterpage and adding the nodes and child nodes dynamically at run time to which the data will be coming from userpage to master page. Everything is working fine. But when i expand a node and click any child node, the child they are getting shrunk again as it is dynamic one. But logically it works and retrieve he expected output.. But i want the child nodes to be in expanded mode after it is clicked.

    Help me to solve this.

    Regards,
    Rajabharathi R
  • #765558
    I think after all your binding operation is done you need to call 'ExpandAll()' method of treeview, see below snippet

    trv.ExpandAll();

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765561
    Hi,

    Try below code snippet,as per your requirement.


    5
    down vote
    For expanding all the nodes use below code

    treeView1.ExpandAll();
    For expanding selected node use below code

    treeView1.SelectedNode.ExpandAll();
    For expanding particular node use below code

    treeView1.Nodes[Index].Expand();


Sign In to post your comments