Is there a programatic way to ensure that a parent node can only have 1 checked child? For instance, consider the following tree:
Marital Status
Single
Married
So if you click Single the code will ensure that the Married not will not be checked. Much like a radio buttons...
Any ideas?
Hello Aaron,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I handled the NodeCheckedChanged event and uncheck the CheckBox if there is another item already checked.. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Stefan actually what i want is if the user checks a node, then decides to check another one.... the original node will be unchecked and the new node will be checked.
when i go to uncheck all nodes the NodeCheckChange event fires until i get a stackoverflow....
I have modified the sample I sent you before, so now it works as you want.
Hope this helps you.
S-
THis looks better but the CheckMode is set to manual.... and is not checking the parent. THis is where the issue occurs because you end up in this loop that you cant get out of.
THere really should be another event that only fires for the node that is checked. Right now if it is set to AUTO it checks from the top most parent down so you have no idea which node was actually checked.
ah yeah the infragisitcs control was too difficult to use... so i went back to the .net control. Everything works great and seems to be faster than infragistics
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
I have modified the sample again and now if you click a child node, the parent is also selected and also the NodeCheckChnage is fire only once because I handled and unhandled the event. Please let me know if you require any further assistance on this matter.
Well yeah that will work... also if you just set the CheckMode to Auto that will work even better.
The issue is the NodeCheckChange fires multiple times. I need it to fire once when a child is checked and have the parent nodes checked.
THe reason is i need to create a contextual representation of the nodes that are clicked to the right of the treeview. The Text version gets created multiple times when the checked procedure fires multiple times.
I have modified the sample again and now if you click a child node, the parent is also selected, which I believe is the functionality you want to achieve. Please let me know if you require any further assistance on this matter.