We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

populating nodes in the TreeViewAdv

Hi forum, I need to populate nodes in the TreeViewAdv when a button is clicked and certain node; for example if there are 5 populated nodes, the third node should be the first selected node not the first node. I don''t know what I am missing. Its not working for me. Please help. Thanks, regards, Peter

2 Replies

DT Deepa TS Syncfusion Team March 1, 2006 09:18 AM UTC

Hi Peter, When a button is clicked you can populate the treeViewAdv with nodes and set needed node as the first visible Node, using the following code snippet. private void button1_Click(object sender, System.EventArgs e) { //Populating Root Nodes and the child Nodes in the treeViewAdv. this.treeViewAdv1.Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("Tools")); this.treeViewAdv1.Nodes[0].Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("TreeViewAdv")); this.treeViewAdv1.Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("Pdf")); this.treeViewAdv1.Nodes[1].Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("Barcode")); this.treeViewAdv1.Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("HTMLUI")); this.treeViewAdv1.Nodes[2].Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("HTML tables")); this.treeViewAdv1.Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("Chart")); this.treeViewAdv1.Nodes[3].Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("Chart Legend")); this.treeViewAdv1.Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("Grid")); this.treeViewAdv1.Nodes[4].Nodes.Add(new Syncfusion.Windows.Forms.Tools.TreeNodeAdv("Cell Types")); //Setting the First Visible Node this.treeViewAdv1.SelectedNode=this.treeViewAdv1.Nodes[3]; //Setting HelpText for the selected Node this.treeViewAdv1.SelectedNode.HelpText="First Visible Node"; //Setting Focus for the treeviewAdv this.treeViewAdv1.Focus(); } Please take a look at the attached sample and let me know if this helps you. Thanks for your continued interest in Syncfusion products. Regards, Deepa.T.S

PopulateNodes.zip


AD Administrator Syncfusion Team March 6, 2006 12:22 PM UTC

Thanks for the sample. It helped me

Loader.
Live Chat Icon For mobile
Up arrow icon