TreeView problem

Discussion in 'ASP .Net' started by christof, Nov 25, 2005.

  1. christof

    christof Guest

    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!!!
     
    christof, Nov 25, 2005
    #1
    1. Advertising

  2. christof

    christof Guest

    Once again a TreeView problem

    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!
     
    christof, Nov 27, 2005
    #2
    1. Advertising

  3. Re: Once again a TreeView problem

    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.



    "christof" <> schreef in bericht
    news:...
    >
    > 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!
    >
     
    Edwin Knoppert, Nov 27, 2005
    #3
  4. christof

    christof Guest

    Re: Once again a TreeView problem

    Edwin Knoppert wrote:
    > 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
     
    christof, Nov 27, 2005
    #4
  5. Re: Once again a TreeView problem

    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.



    "christof" <> schreef in bericht
    news:...
    > Edwin Knoppert wrote:
    >> 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
     
    Edwin Knoppert, Nov 27, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VHltYm93?=
    Replies:
    2
    Views:
    24,537
    =?Utf-8?B?VHltYm93?=
    Jan 10, 2006
  2. abargaddon
    Replies:
    0
    Views:
    1,088
    abargaddon
    Jan 17, 2008
  3. Per Salmi

    TreeView not rendering nodes? Cacheing of a TreeView

    Per Salmi, Oct 15, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    490
    Steve Drake
    Oct 15, 2003
  4. Ionutz
    Replies:
    2
    Views:
    545
    Ionutz
    Oct 23, 2005
  5. stepkurt

    Microsoft Treeview vs System Treeview

    stepkurt, Aug 29, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    400
    Teemu Keiski
    Sep 2, 2007
Loading...

Share This Page