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.
Unfortunately, activation email could not send to your email. Please try again.

How to make a treeNodeAdv visible FALSE

Thread ID:

Created:

Updated:

Platform:

Replies:

76371 Sep 4,2008 02:17 AM Nov 13,2008 05:59 AM Windows Forms 3
loading
Tags: Tools
Maverick
Asked On September 4, 2008 02:17 AM

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.


Hemaladha K [Syncfusion]
Replied On September 8, 2008 05:47 AM

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


Administrator [Syncfusion]
Replied On November 11, 2008 02:28 AM

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.





Fathima Shalini P [Syncfusion]
Replied On November 13, 2008 05:59 AM

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



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.

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.

;