Solved

Check selected TreeView Node is parent or not

Posted on 2007-03-22
3
1,374 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 86

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Input parameteres to DragOver 2 38
JQuery Detecting page post back 6 20
Coding for the first time 9 70
.Net remove carriage returns, line feeds and tabbs 5 15
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 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