Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Check selected TreeView Node is parent or not

Posted on 2007-03-22
3
Medium Priority
?
1,380 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:
Fahad Mukhtar earned 500 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 500 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

618 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