I'm trying to create a prototype in asp.net web form where clicking on a treeview item changes views within a multiview. I've created all the views that I need and I now need to configure it so that clicking on a treeview item will change the multiview to the corresponding view.
My treeview has this structure: A project has 2 subcomponents: parts, users. Furthermore, parts can have multiple subparts. So when clicking on a project, I want to load the view associated with projects, in this case, its called view1. And when clicking on a part, it should load view2, and so on.
My best guess is that I can somehow extract the level(counting from root) of the selected treeview item and from there load its view. But how would I do that? Also, since project has 2 subcomponents which each have its own view, a treeview item level might not be sufficient since both parts and users will be on the same level. So how would I go about solving this?
I've figured it out.
TreeView.SelectedNode.Depth provides the level at which the selected node is at. I thought I had to do some recursive traversal from the selected node and stuff like that but looks like its a lot simpler than that. =)
I still have the problem of having multiple views that correspond to the same depth though.