Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,
I have a designed an application in such a way that i will have a treeview initially with a Root node. If i right click on the root node i will have a context menu with the some options. By selecting an option i will add a child to that root node. Now if the tree has a child node and if i right click again i would like to display an error message as only one child allowed or some thing or i would like to disable the context menu.

Can any one help me please
Posted

1 solution

OPTION 1:
While creating/adding a child node, disable or dont attach the right click handler to it.

OPTION 2:
Store a flag in nodes - IsChild. Based on it's value, if false, show context menu. If true, show a message or just ignore the event.

Try!
 
Share this answer
 
Comments
demouser743 18-Sep-10 5:35am    
Hi can i have a sample code please
Sandeep Mewara 18-Sep-10 5:37am    
There is nothing much to provide a sample code. If you have done all what you said you already have then this is very simple and you can implement it. Try!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900