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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hierarchial TreeviewAdv node selection

Thread ID:

Created:

Updated:

Platform:

Replies:

82390 Jun 11,2009 12:51 PM UTC Jun 12,2009 10:24 AM UTC WinForms 1
loading
Tags: Tools
Administrator [Syncfusion]
Asked On June 11, 2009 12:51 PM UTC

Hi,
Is it possible to have a hierarchical selection in the tree with check options as shown below. If the user selects A then if B is selected previously it should be unselected. This can be done by setting the SelectionMode property to single. Similarly When child nodes if A2 is Selected then all the selected items of the other child A1 should be unselected including parent B and its children should be unselected. But the level 3 child nodes can be multi-selected.
How to achieve this using TreeViewAdv?

A
A1
a1
a2
A2
a1
a2
B
B1
b1
b2
B2
b1
b2

Thanks in advance

Fathima Shalini P [Syncfusion]
Replied On June 12, 2009 10:24 AM UTC

Hi Nitroxn,

Thank you for your interest in Syncfusion Products.

We can perform multiple selection in the sub nodes and single selection in the parent nodes in the TreeviewAdv's click event. Kindly refer to the code snippet and the sample given below that illustrates this


private void treeViewAdv1_Click(object sender, EventArgs e)
{
Point controlPoint = this.treeViewAdv1.PointToClient(Control.MousePosition);
TreeNodeAdv node = this.treeViewAdv1.GetNodeAtPoint(controlPoint);
if (node != null)
{
if (node.Level == 3)
{
this.treeViewAdv1.SelectionMode = TreeSelectionMode.MultiSelectSameLevel;
}
else
{
for(int i=0;i {
if (this.treeViewAdv1.SelectedNodes[i].Level == 3)
{
this.treeViewAdv1.SelectedNodes.Clear();
this.treeViewAdv1.SelectedNodes.Add(node);
}
}
this.treeViewAdv1.SelectionMode = TreeSelectionMode.Single;
}
}
}


http://files.syncfusion.com/support/Tools.Windows/7.2.0.20/F82390/main.htm

Please let me know if any concerns.

Regards,
Fathima

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;