Solved

Check selected TreeView Node is parent or not

Posted on 2007-03-22
3
1,366 Views
Last Modified: 2007-12-19
Hi..
How to check the selected TreeView node is a parent node or not ?

I am implementing a drag and drop facility to in the TreeView. Condition is if the parent node tries to drag it should not allow, only the child should allow to move to any other parent.

Thanks in advance

sun4sunday
0
Comment
Question by:sun4sunday
3 Comments
 
LVL 19

Accepted Solution

by:
Desp earned 125 total points
ID: 18770702
Check for

(TreeView.SelectedNode.LastNode!=null) // means its parent


or
(TreeView.SelectedNode.Nodes.Count >0l) //,means it has some nodes ..its a parent
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 125 total points
ID: 18775307
You might also want to check first that SelectedNode itself isn't null...

if (TreeView1.SelectedNode != null)
{
    if (TreeView1.SelecedNode.Parent != null)
   {
      // the TreeNode is a child...
   }
}
0
 
LVL 9

Author Comment

by:sun4sunday
ID: 18797724
Thanks for the solutions
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Log4Net custom Appender not being fired. 5 74
IO.FileSystemWatcher dies when used in Powershell 1 44
Connection String 16 43
Angular - break the dataset in chunks? 7 39
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now