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

How to make a treeNodeAdv visible FALSE

Hi SyncFusion Team
I need to hide a node of treeviewAdv but cannot find something appropriate to hide a single node of tree something like TreeNodeAdv.Visible= FALSE or so.

Can you please help me in this regard.

Regards,
Maverick.


3 Replies

HK Hemaladha K Syncfusion Team September 8, 2008 09:47 AM UTC

Hi Maverick,

Thank you for your interest in Syncfusion Products.

TreeNodeAdv isn't a control so it doesn't have a Visible property. It's just a data structure for telling the tree what to render, so the absence of the TreeNodeAdv in the TreeViewAdv's Node's collection will prevent it from displaying. The IsVisible() property returns true when the parent node is expanded, otherwise is returns false. There is no property to hide or display a node.

Please let me know if any concern.

Regards,
Hema



AD Administrator Syncfusion Team November 11, 2008 07:28 AM UTC

since TreeNodeAdv is not a control, there is no way to hide this tree node?

I have a tree like this:
1
|---2
|---3

what I want to do is to hide tree node 2 in some cases or to hide tree node 3 in some cases or to show all tree nodes in other cases, how can I do this?

the only tree is to rebuild the whole tree in every condition?

I think if there is a way to hide tree node, we can filter tree nodes which we don't want to see, so we only need construct the whole tree only once.






FS Fathima Shalini P Syncfusion Team November 13, 2008 10:59 AM UTC

Hi,

Thank you for your update.

Since TreeNodeAdv doesnot have any built in method or property to hide or show TreeNodeAdv, please find the below workaround that hides and shows the TreeNodeAdv by changing its Height and Text property:


private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < this.treeViewAdv1.Nodes.Count; i++)
{
if (i % 2 == 0)
{
this.treeViewAdv1.Nodes[i].HelpText = this.treeViewAdv1.Nodes[i].Text;
this.treeViewAdv1.Nodes[i].Text = "";
this.treeViewAdv1.Nodes[i].Height = 0;
}
}
}
private void button2_Click(object sender, EventArgs e)
{
for (int i = 0; i < this.treeViewAdv1.Nodes.Count; i++)
{
if (this.treeViewAdv1.Nodes[i].Height == 0)
{
this.treeViewAdv1.Nodes[i].Text = this.treeViewAdv1.Nodes[i].HelpText;
this.treeViewAdv1.Nodes[i].Height = 16;
}
}
}


Please refer to the below sample that illustrates this:

http://websamples.syncfusion.com/samples/Tools.Windows/F76371/main.htm

Please let me know if any concerns.

Regards,
Fathima



Loader.
Live Chat Icon For mobile
Up arrow icon