find parent node in treeview

Im using treeview in asp.net

how can i check if parent contains childnodes in treeview selected node changed event.

Answers


In case you want to look if the parent of the selected node contains other children nodes, it is safe to say

bool ContainsOtherChildren = treeView1.SelectedNode.Parnet.ChildNodes.Count > 1;

since you know that it already has at least one child node (the selected one)

I would however make another check if there is indeed a parent such as

if(treeView1.SelectedNode.Parent != null)
{
   ContainsOtherChildren = treeView1.SelectedNode.Parnet.ChildNodes.Count > 1;
}

Check All the child pointer values, whether is it NULL or not.

If all child pointer value is NULL , you can ensure that the parent does not have any child.


Need Your Help

Javascript, Jquery problems with variables

javascript jquery class variables

I'm having a problem using variables with Jquery, and i just can't figure out what the problem is.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.