This question is locked. New answers and comments are not allowed.
Hi,
How do I persist state in treeview after redirect? For example if I expand "Parent A" Node then select "Child A.1" node where Child A.1 Node is a link. After I clicked on the link, the page is refreshed, the treeview however should persist its state.
Parent A
Child A.1 (where Child A.1 = url(http://localhost/user/userid=1)
Child A.2
Parent B
Child B.1
Child B.2
Can you please show me how to resolve the issue
thanks
How do I persist state in treeview after redirect? For example if I expand "Parent A" Node then select "Child A.1" node where Child A.1 Node is a link. After I clicked on the link, the page is refreshed, the treeview however should persist its state.
Parent A
Child A.1 (where Child A.1 = url(http://localhost/user/userid=1)
Child A.2
Parent B
Child B.1
Child B.2
Can you please show me how to resolve the issue
thanks
5 Answers, 1 is accepted
0
Hi telaron,
I take it that the TreeView is in a master page? The node "Parent A" should call Expanded() like this:
.Text("Parent A").Expanded(ViewContext.RouteData.Values["controller"].ToString() == "user")
Sincerely yours,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I take it that the TreeView is in a master page? The node "Parent A" should call Expanded() like this:
.Text("Parent A").Expanded(ViewContext.RouteData.Values["controller"].ToString() == "user")
Sincerely yours,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
telaron
Top achievements
Rank 1
answered on 25 Mar 2010, 04:52 AM
Hi Alex,
Thanks for the solution. Howerver, the solution you provided only work for 1 particular node, what if I have mutliple nodes expanded as shown below and when the page is refreshed I want the treeview to preserve the nodes that I expanded. More specifically, if I expand Parent C, then expand Parent D and within Parent D I expand Child D2 and then Click on Child D2.1 where Child D2.1 is a link which causes the page to refresh.
Parent A
Parent B
Parent C
Child C1
Child C2
Parent D
Child D1
Child D2
Child D2.1
Child D2.2
So how do i preserve the state of the treeview after refresh
Thanks
Thanks for the solution. Howerver, the solution you provided only work for 1 particular node, what if I have mutliple nodes expanded as shown below and when the page is refreshed I want the treeview to preserve the nodes that I expanded. More specifically, if I expand Parent C, then expand Parent D and within Parent D I expand Child D2 and then Click on Child D2.1 where Child D2.1 is a link which causes the page to refresh.
Parent A
Parent B
Parent C
Child C1
Child C2
Parent D
Child D1
Child D2
Child D2.1
Child D2.2
So how do i preserve the state of the treeview after refresh
Thanks
0
Hello Nathan,
For more complex scenarios, such as yours, you have to maintain the TreeView state manually by attaching a JavaScript handler to the OnExpand / OnCollapse client-side events and populating a cookie. On page refresh, the cookie will be sent to the server and you can use it to load the state.
Kind regards,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
For more complex scenarios, such as yours, you have to maintain the TreeView state manually by attaching a JavaScript handler to the OnExpand / OnCollapse client-side events and populating a cookie. On page refresh, the cookie will be sent to the server and you can use it to load the state.
Kind regards,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
telaron
Top achievements
Rank 1
answered on 25 Mar 2010, 10:50 PM
hello Alex,
Any chance you can provide me with a working solution for my scenario?
thanks
Any chance you can provide me with a working solution for my scenario?
thanks
0
Hello Nathan,
We thought that this would be a common scenario, so we promoted it to a KB article - persisting TreeView state in cookie. Let me know if you have any feedback.
All the best,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
We thought that this would be a common scenario, so we promoted it to a KB article - persisting TreeView state in cookie. Let me know if you have any feedback.
All the best,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.