How to switch views from a multiview upon a click of a treeview item? - asp.net

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.

Here's how I did it.
On my page I have 2 columns. On the left is the treeView1 and on the right Multiview1 with several Views.
Page Load is set at MultiView1.ActiveViewIndex = 0
By double clicking the TreeView in Design Mode, it creates the Sub routine Handler
Protected Sub TreeView1_SelectedNodeChanged(sender etc etc etc)
End Sub
I added the following code inside the Subroutine
If TreeView1.SelectedNode.Value = "value of the treeview node" Then
MultiView1.ActiveViewIndex = 1
End If

Related

Set enable/disable on menuitem depending on data modification

I am new on java and javafx. I made a simple application on javafx using mvc pattern. This application handles a person table and is structured in this way.
Model containing the persons data
View containing a menu
View containing the tableview of the persons, the detail of the selected person and three buttons (New --> add new person, Edit --> change a person, Delete --> cancel a person
View that allows to change contents of the selected person
All works fine, but I have a problem with the menu. I would like to handle the menuitem 'Save' changing the 'Disable' flag in the way that it set to 'false' or 'true' programmatically, depending on if the user changed the data or not, but I do not know how can pass it from a scene to another.
I have been searching a lot on this web site and on other sites without any result.
I have found a question on stackoverflow called 'Toggle enable/disable on Menuitem javafx from another scene?' that probably could solve my question, but unfortunately I did not understand the solution.
Is there somebody who can help me?
Thank you in advance.
Alberto

Qt: How to share QListWidget Data between QWizard Pages

I have a three wizard pages, Page1,Page2 and Page3. In Page one i have a Qlist widget which has some 10 items, and the user selects three of these items and clicks next button. Now before i go to the next page (may be in Page 2 initalizePage() method) I would like to create dynamically one label for each item selected, so in this case three labels. How can i achieve this?
I do not want to use model view, and preferable not even getter functions. The pages are totally different classes and only has a base wizard page common inheritance. Thank you

Keeping ASP.Net TreeView nodes collapsed when navigating web site

I noticed that when navigating an ASP.Net web site the nodes in the TreeView always expand.
Is there a setting or attribute we can include in the markup that will keep the TreeView nodes collapsed until the user expands them?
Maybe something is needed to be added to the code-behind file?
Yes there is, it's called ExpandDepth
ExpandDepth - Gets or sets the number of levels that are expanded when a TreeView control is displayed for the first time.
If you want all the nodes, including the root, to be collapsed just set it to 0
<asp:TreeView ExpandDepth="0" ...
I don't think you can do this in the markup. But it is possible in code - behind. Check out this link for some sample code: Collapse all open nodes.
I'm pretty sure that an app I wrote a few years collapses the entire tree with one line of code (like you we found that it kept opening up every post back). If this link doesn't work I will post the code I used tomorrow.
The one line of code I was looking for is
tv.CollapseAll();

how to assign menu control to sub-node of sitemap on masterpage

i am using menu controls on my master-page and have used sitemap data-source to populate it. It shows main node on menu. is there a way that it populates the menu with sub-nodes of my master node rather than using default "home" ie masternode as starting menu item.
when you create a site map, you always design your properties in a way that it suites your web needs, They will contain, your starting node, name display, view state and autopostback.
Check your sipemapdatasource properties and your will know how to do that
You just simply put the ShowStartingNode = False in the SiteMapDataSource properties.
IT was simpler than i thoght.

ListView Edit item Position

I have a Listview in my aspx page with Insert template and Edit template. and a Add New LinkButton.
When a user clicks on Add New LinkButton I am able to specify Insertitem Position so that the Insert TEmplate appears at the bottom of the listview. But how to I make the edititem template to appear at the bottom like the Inserttemplate
Its not available for the EditItemTemplate.
You'd have to actually save the original position, move the item in the data source itself (probably IList compatible), rebind the view, trigger editing on the new position, then swap the data item back to the original position.
I wouldn't recommend it. It's nonintuitive behaviour for users anyway; when I decide to edit something I should either be able to edit in place or edit on an entirely separate form. It's very rarely good UI design to shuffle items around while users are working on them, especially if you have any sort of scrolling/paging going on.

Resources