This is a migrated thread and some comments may be shown as answers.

Expanding tree to specific node based on query string

2 Answers 52 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 29 Oct 2015, 01:13 PM

Hello,

 I have a page that has a treeview that lists our different zip files of data that users can download.  When the user click a zip file to download and they are not logged in they are redirected to the login page.  After they login they are redirected to the page where my zip files are listed in my treeview.  The issue now is the page reloaded and the tree is collapsed.  How can I open the tree to the specific node the user clicked on?  I can put the node text in a query string and page it back and forth but how can I take the query string and open the treeview?

 

Thank you

2 Answers, 1 is accepted

Sort by
0
Jerry
Top achievements
Rank 1
answered on 02 Nov 2015, 02:53 PM
Did I post this in the incorrect place?
0
Ivan Danchev
Telerik team
answered on 04 Nov 2015, 02:31 PM
Hello Jerry,

If you have saved the node's text in a query string you can retrieve the value in the Page_Load handler, use it to find the node and expand it as shown below:
string node = Request.QueryString["node"];
if (node != null)
{
    RadTreeView1.FindNodeByText(node).Expanded = true;
}

Regards,
Ivan Danchev
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
TreeView
Asked by
Jerry
Top achievements
Rank 1
Answers by
Jerry
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or