Solved

Single node in a TreeView without a checkbox

Posted on 2004-10-07
6
679 Views
Last Modified: 2008-02-01
Hi Experts

I have a TreeView control with two main nodes (Parent1 and Parent2), each of which has children, they have children, etc. I have enabled the checkboxes for the TreeView and everything is fine. The only little problem is, that the Parent1 and Parent2 nodes are actually just grouping and the logic is that they cannot be selected. Is it possible that only those two nodes have NO checkboxes, whilst all others have?

Thanks
TheAvenger
0
Comment
Question by:TheAvenger
6 Comments
 
LVL 10

Expert Comment

by:smegghead
ID: 12248858
I've done this in the past, but it's not a very tidy solution.. and I'm sure you've thought of this already.

What you can do is not have checkboxes, but apply an image to each treenode, one of those images would be a square with a cross in it, the other just a square, and the other nothing.. Then, when you click an item, toggle it's checked property and change to the relevant image.
0
 
LVL 20

Author Comment

by:TheAvenger
ID: 12248935
Hmm, does not seem like the perfect solution. Still 10x for the suggestion.

Have you come accross any custom TreeView control, that is reacher than the one from MS?
0
 
LVL 8

Assisted Solution

by:Razzie_
Razzie_ earned 125 total points
ID: 12253802
TheAvenger,

Might want to take a look at http://www.codeproject.com/cs/miscctrl/treelistview.asp?df=100&forumid=13572&exp=0&select=756432

It is a custom TreeView control, from which I know it for example supports custom checkboxes, and I believe you can disable checking a checkbox... so I hope it comes close to what you want.

HTH,

Razzie
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
LVL 8

Expert Comment

by:Razzie_
ID: 12253808
And maybe it will help with your other question too :)
0
 
LVL 18

Accepted Solution

by:
armoghan earned 125 total points
ID: 12256344
this might be helpful
http://www.codeproject.com/cs/miscctrl/TreeViewRadioBox.asp

You may be able to add a node which is a treenode
TreeNodepollNode =
     new TreeNode("Survey");
0
 
LVL 20

Author Comment

by:TheAvenger
ID: 12256505
Thank you very much guys!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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 describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

861 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