views:

24

answers:

1

Hi all, I will have a treeview with a root node initially and i will have context menu to be opened when i right click on the root node. AFter that i will save a file to save my data in to that. Alng with that i will load a child node for that . So that tree will looks as follows

  Root
     |-> some.txt
         |-> A(child for some.txt)

And if i right click on the Node A i will have a form that user will fill some data and save it. If the save was successful i will have my treeview as follows

Root
  |-> some.txt
    |-> A(child for some.txt)
       |->B(Child for A)

Now what i need if the use again right clicks on A node i would like to show some error message or i would like to have that node as non selectable field.

Any idea please

A: 

In the same place where you are opening your form for the node that was right-clicked, you can do a check for whether or not that node has children.

if(myNode.Nodes.Count == 0)
{
   //Open your form
}
else
{
   //Show error or perform alternative actions
}
msergeant