TreeView problem

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!
 
G

Galin iliev

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
 
C

christof

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top