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.
Syncfusion Feedback

How to access a parent with the level as index?

Thread ID:

Created:

Updated:

Platform:

Replies:

46770 Jul 20,2006 09:34 AM UTC Jul 20,2006 09:48 PM UTC WinForms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 20, 2006 09:34 AM UTC

Hi,

I''m working in different levels and i always need to get the correct text of a parent.

Example:
Currently i''m on level 3 and i have to access it this way.
e.Node.Parent.Parent.Text

But if i''m on level 5 it has to be like this
e.Node.Parent.Parent.Parent.Parent.Text

So it''s much better accessing the correct
Parentnode with level as index.

How can i realize this?

thx
Dennis

Administrator [Syncfusion]
Replied On July 20, 2006 05:25 PM UTC

I am not sure what kind of thing e.Node is? I do not that we have any such e.Node properties in any of our grids (but may be wrong).

You can probably write a recursive method like this. I am not sure exactly what test you use, but for the sake of this pseudo code, I will assume Node has a property Level that is zero when you are at the outer most node.


private Node GetOuterNode(Node n)
{
if(n.Level == 0)
return n;
GetOuterNode(n.Parent); //recursive call

}

Administrator [Syncfusion]
Replied On July 20, 2006 09:48 PM UTC

This is strictly psuedo code in that I do not know what the classes are. But I did see a mistake in the previous snippet I posted.

private Node GetOuterNode(Node n)
{
if(n.Level == 0)
return n;
return GetOuterNode(n.Parent); //recursive call

}

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

;