TreeView problem

C

christof

It'll be really easy...Sorry for that question:

I've got a MasterPage <%@ Master Language="C#" ClassName="MasterP" %>
and some slave.aspx.<%@ Page Language="C#"
MasterPageFile="~/Master1.master" AutoEventWireup="true"
CodeFile="ShowDatabases.aspx.cs" Inherits="ShowDatabases"
Title="Untitled Page" %><%@ MasterType VirtualPath="Master1.master" %>

In the slave page I'm creting and populating a TreeView which I would
like to pass to my MasterPage , where exists a TreeView Control.So I've
defined a function


//MasterPage code,

public void FetchTree(TreeView dbs)
{
//the right code ;) // tried TreeView2 = dbs; but fails
}

//slave page code

Master.FetchTree(treeCreatedInSlave);

(There's no doubt about code, because when I type Master. the
IntelliSense sees the FetchTree method. I'm telling this, because my
problem is only in the tree.)

So how to do it without
I know I could build XML from slave tree and then get that XML in master
but I belive there's a faster way!

Thanks!!!
 
C

christof

Really nobody :(

Maybe I've described the problem wrong. So I repeat:

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

Edwin Knoppert

What do you mean by 'site'?

If it's just another page and session remains..?
You can store it in a session or flat (xml)file.
If it's the same app. you could try to use previous page object and enum the
parts over.
Not sure if that will work.
 
C

christof

Edwin said:
What do you mean by 'site'?

If it's just another page and session remains..?
You can store it in a session or flat (xml)file.
If it's the same app. you could try to use previous page object and enum the
parts over.
Not sure if that will work.

There is no problem with storing it, but how to make the other TreeView
just exactly the same as one that I've created. So some kind of copying
objects.

TreeView2 is on a MasterPage
TreeView1 is on other page

TreeView2 = TreeView1;

So I've got exactly the same tree in both sites!
That's what I'm asking, thanks
 
E

Edwin Knoppert

There was a question about getting controls on such pages a few days ago.
Then i assume simply copying properties?
Like styles and such.
+ copying the items of course.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top