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

Selection of Nodes

Hi I want to allow the user to select only certain nodes in treeview. I used args.cancel in BeforeSelect event, but it failed to work. I want only certain nodes to get selected and the others should have dotted rectangle. Thanks, Ben

1 Reply

DT Deepa TS Syncfusion Team April 10, 2006 01:47 PM UTC

Hi Ben, You could allow the user to select only certain nodes and the make only the selectable nodes get selected, while the non-selectable nodes just have a dotted rectangle around them and are not selected by handling TreeViewAdv AfterSelect event handler. Code: private void treeViewAdv1_AfterSelect(object sender, System.EventArgs e) { TreeNodeAdv node =this.treeViewAdv1.SelectedNode; if ((node.Text == "Node0") || (node.Text == "Node2") || (node.Text == "Node4") || (node.Text == "Node6")|| (node.Text == "Node8")) { this.treeViewAdv1.SelectedNodes.Remove(node); } } Please take a look at the attached sample and let me know if I have understood your problem correctly. SkipSelection Thanks for your interest in Syncfusion products. Regards, Deepa.

Loader.
Live Chat Icon For mobile
Up arrow icon