Hi,
I'd like to copy a node from TreeView to another Treeview but I want to keep each Cells of the nodes databound from DataTable.
The Clone methode doesn't clone cells.
From a node with cells, the result is a node with only a single value ...
Code :
trvProjects.DataSource = dsBudgetMap; trvProjects.DataMember = "BUDGET";
foreach (UltraTreeNode tnTas in tnPro.Nodes) trvTaskLate.Nodes.Add(tnTas.Clone());
Yeah, its working but not very optimized, that's all.
Thanks. We can close this thread.
That sounds like a reasonable approach. it's not clear to me from your post if you still have an open question, or if you have solved your issue. Do you still need assistance with this? Or have you got it working the way you want, now?
I have 2 TreeView.
The first is databound from database (with DataSet), the other one is empty and filled with specific node in the TreeView.
If a level 3 node has a certain value so, I pick it up and add it to the other treeview (copying not moving). For the moment, I select with criteria the row from DataSet and import it on a second empty data set (cloning the first dataset), then databind the second TreeView.
Well... that's not a correct assumption. The node's behavior depends on other things in the control. The ColumnSet, which defines which columns are displayed by the node, are not part of the node, they are part of the tree. They are created by and assigned to the tree control on one of the Override objects.
The data for the node comes from the data source, which is also part of the tree and not really part of the node. So the node is dependent on a lot of outside factors. So I'm afraid there's no single method that will clone the node and it's entire environment.
I'd like to offer you more specific advice, but it's very hard to do since I don't really know what you are doing, what the situation is, what the requirements are, etc.
If we assume that a node is a set of properties with Cells, values, it makes sense to think that all the node structure is cloned ^^
I wanted a simple way, but I cloned the datatable to import Row from the current Node. All this process just to clone 100% a node.