Click here to Skip to main content
15,886,734 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

I developed two tree control with allocate and unallocate button
allocate button move selected nodes from tree1 to tree2
unallocate button move selected nodes from tree2 to tree1


I done the above points correctly.
Tree 1
- Page Content(Parent Node)
    Add Page
    List Pages
    Add Banner
    List Banners



My problem is, first i select few child nodes(List Page,List Banner) from parent node(Page Content)of Tree1 and click allocate button,they will allocate to another tree correctly like below:
Tree 2
List Page
List Banner

if i select remaining child nodes(add page, add banner) from same parent node(Page Content) and click allocate button means, they will not replace the existing nodes with current selection.

instead of that, they look like follows;
Tree 2
List Page
List Banner
- Page Content
    Add Page
    List Page
    Add Banner
    List Banner


But I need that, if i select remaining child nodes from same parent means,

I need the output as follows:

- Page Content
    Add Page
    Add Banner
    List Page
    List Banner

Please friends help me to solve this
Posted
Updated 2-Dec-13 7:45am
v4
Comments
Sebastian T Xavier 2-Dec-13 1:42am    
too much code?
BillWoodruff 2-Dec-13 3:08am    
You need to give more details about what your goal is here. Under what circumstances do you need to replace (write over) nodes ? Not clear exactly what you mean by "allocate" and "unallocate:" allocate sounds like a move, but what is unallocate ?

1 solution

Once you've removed the branches 'List Page' and 'List Banner' and move them to the other Tree, they are now trunks. When you move them back you are moving two trunks back and now have 3 trunks, the relationship has been lost.

What you are trying to do is generally done with list boxes where there isn't any relationship between the items.

You will need to do a lot more work to get this to do what you are trying. One way would be to 'Hide' the items on one side and then check to see when you 'unallocate' if it already exists and 'unhide' it.

Using a tree in this manner seems to be a poor choice (back and forth). If you want to use a tree then you can have one tree and have check boxes at each node that indicate allocation that you can turn on and off.
 
Share this answer
 

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