P
Per Salmi
I have a rather large TreeView in a web form. This is built from database
content.
What is the easiest way to store the TreeView NodeCollection so that I don't
have to build it again from the database when a new request for the same
page is performed?
I have tried storing the treeview object in an Application variable and
retrieving it checking that it is populated with nodes and then setting the
treeview object to use this retrieved treeview.
The page works but the tree is not rendered to the page.
Is there a way to refresh the treeview after setting the object in the
Page_Load event handler?
The code in the Page_Load event handler looks something like this:
if (Application["treeview"] == null) {
PopulateTreeView(); // This one fills the NodeCollection with content
Application["treeview"] = treeview1; //Store the treeview for future
reuse
} else {
treeview1 = (TreeView)Application["treeview"]; // Get the existing
treeview
}
I have checked that the Nodes list contains the expected nodes when the
treview is reused from the Application variable but why does it not render
the tree when the nodes are there?
/Per Salmi
content.
What is the easiest way to store the TreeView NodeCollection so that I don't
have to build it again from the database when a new request for the same
page is performed?
I have tried storing the treeview object in an Application variable and
retrieving it checking that it is populated with nodes and then setting the
treeview object to use this retrieved treeview.
The page works but the tree is not rendered to the page.
Is there a way to refresh the treeview after setting the object in the
Page_Load event handler?
The code in the Page_Load event handler looks something like this:
if (Application["treeview"] == null) {
PopulateTreeView(); // This one fills the NodeCollection with content
Application["treeview"] = treeview1; //Store the treeview for future
reuse
} else {
treeview1 = (TreeView)Application["treeview"]; // Get the existing
treeview
}
I have checked that the Nodes list contains the expected nodes when the
treview is reused from the Application variable but why does it not render
the tree when the nodes are there?
/Per Salmi