TreeView problem

  • Thread starter Thread starter christof
  • Start date Start date
C

christof

I've got a really easy problem, please help me:

There are two pages in one I'm creating a TreeView like that:

TreeView dbTree = new TreeView();

TreeNode dbTreeRoot = new TreeNode("Root");
dbTree.Nodes.Add(dbTreeRoot);
..
..

- so my complete TreeView is populated in that code.
Now I wish to pass this whole TreeView to another site, where I've got
my TreeView Control:

<asp:TreeView ID="TreeView2" runat="server">
</asp:TreeView>

So how to pass this tree to put it into that control??

I thing that it should be a function in the second page:

public void FetchTree(TreeView source_tree)
{
// - the code, I've tried TreeView2 = source_tree, but it's not a solution
}

Or the only way is to save a TreeView to XML in a first, and then to
retrive it from XML in a second page to the control directly.

Thank you in advance!
 
Hi christof
you will have to save treeview controls data somewhere and pass this data to
other page
you could use Session, Application state to use this

I suggest you to pass encoded XML to second page and then read it and build
second tree

Hope this help
 
Galin said:
Hi christof
you will have to save treeview controls data somewhere and pass this data to
other page
you could use Session, Application state to use this

I suggest you to pass encoded XML to second page and then read it and build
second tree

Hope this help

But you mean to do xml from scratch?

XmlDocument ...
...


or is there a ready method TreeView -> XML?

Thanks
 
Back
Top