Solved

Check selected TreeView Node is parent or not

Posted on 2007-03-22
3
1,362 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for the solutions
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

11 Experts available now in Live!

Get 1:1 Help Now