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

Retain the treeview's expanded mode after postback/reload the form

2 Answers 445 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Dineshkumar C
Top achievements
Rank 1
Dineshkumar C asked on 25 Apr 2010, 09:32 AM
I am using a split in a screen, left side radTreeview and right side corresponding details going to show for all nodes in that treeviewNodes.

First i expand the tree for few levels and the click a node, the information could display at right via postBack.

Right side information is ok but Left side tree was collapsed after postback because i am rebinding the information for treeview due the dynamic controls is in treeviewNodes, like labels & link buttons. Thats why i am rebinding the treeview.

I want to retain the treeview position (same as before postback) after postback.

Kindly, give a remedy for this issue.

Thanks,
Dineshkumar.C

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Apr 2010, 08:37 AM

Hi Dineshkumar.C,

One suggestion is that to use the GetXML() method to get the current state of RadTreeView as XML string and save the XML string. When you decide to restore your Treeview call the LoadXmlString() method to populate the treeview from the previously stored XML String. Please refer the forum link which discusses similar scenario.

RadTreeView save expanded state

Also go throuigh the code library which shows how to keep the expanded state of r.a.d.treeview between postbacks when the treeview is being bound upon each postback. 

Save the expanded state of the TreeNodes when the treeview is being bound upon each postback

-Shinu.

0
Dineshkumar C
Top achievements
Rank 1
answered on 30 Apr 2010, 06:58 AM
Hi Shinu,

You were right for working with the radTreeVIew without dynamic controls.

But in my scenario i am using dynamic controls.

I have attached my treeView structure FYI.

Kindly see that and then give a remedy to me.

In that treeview ACOM,BCOM,CCOM are labels and not nodes, they were placed on the nodes and the Add is the link button.
Both the label and the link button generated dynamically. Hence while you GetXml() -> It retrieves the only nodes and their values not the dynamic controls. So pls help me.

My all events with dynamic controls only. i.e., click event with the labels and linkbuttons represented above.
I have tried with your example. That is , storing the treeview in XML format to a Session variable and retrieve it viewstate again. It works for the only nodes of the treeview alone and not for dynamic controls which was said already on above.

Kindly give remedy for my scenario.
Thanks,
Dineshkumar.C
Tags
TreeView
Asked by
Dineshkumar C
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Dineshkumar C
Top achievements
Rank 1
Share this question
or