Build my treeview only once

Not sure how to fix this:
I have a master page. I reserve the left side for my menu options.
I have, for example, 5 pages. on p5.aspx, I display the treeview.
User clicks on a node and goes to p6.aspx.

*** issue: I have to keep building the treeview for each page. I want to build it once and have it stick for all the pages. Do I need to use a second master page with only the treeview on it? I even used a usercontrol but even with that..with each node clicked, with each new page displayed, the side treeview has to be built.
Any ideas?
LVL 7
CamilliaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
monarch_ilhanConnect With a Mentor Commented:
You may keep your treeview structure in a Session object. After creating/populating treeview in first load, put it to the session ( Session["MyLoadedTree"]=myTreeViewControlName; ) And in other pages load event you can unbox session object and add a panel control.

TreeView tvw=(TreeView)Session["MyLoadedTree"];
Panel1.Controls.Add(tvw);
0
 
ShazbotOKCommented:
if you have the treeview in the page_load statement you may want to setup validation as to "isnewsession" or "ispostback" so the object does not get rebuilt every time
0
 
CamilliaAuthor Commented:
I do have "ispostback" . Each page will use Master page.  I did this for uniform look and feel.
So, p1.aspx, p2.aspx, p3.aspx, p4.aspx. p5.aspx...ALL have the Master page.

I display the treeview in p5.aspx and want it to stick.

Now, p6.aspx (this is the one related to the treeview node) also has the master page. So, when i click on the node, i go to p6.aspx, Master page is called again and the treeview has to be binded again. Otherwise, outside ispostback, inside ispostback wont make a differece.

I dont think this is doable..i think i have to keep rebuilding the treeview for each page that I call from the treeview node...
0
 
CamilliaAuthor Commented:
Monarch - i didnt see your note , let me read...
0
 
CamilliaAuthor Commented:
Do you think keeping the treeview in a session is not bad...at most 100 users... 20 nodes and at most 20 subnodes under SOME of the nodes...
0
All Courses

From novice to tech pro — start learning today.