We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

TreeViewAdv : How can I save the contents/state?

Hello,

I have a treeviewadv and I would like to save/restore its contents and state on a per-user basis.

I don't see any methods that expose this type of functionality; am I missing them?

Keith


3 Replies

AD Administrator Syncfusion Team August 12, 2008 01:28 PM UTC

Hi Keith,

Thank you for your interest in Syncfusion Products.

You can use the AppStateSerializer class be used to save a tree's state such that it can be reloaded with the nodes in the same order as it was saved, the ApStateSerializer does not create any controls, i.e., the TreeViewAdv or its TreeNodeAdvs, but only applies a saved state to it. So in order to persist the state of a TreeViewAdv, you would have to parse through the entire list of nodes in the TreeViewAdv and create a similar Tree like datastructure. Each node of this datastructure could be a custom Class that stores all the information about the node like its text, associated image indexes, collapse/expand state etc. Now persist or retrieve this datastructure using the AppStateSerializer's SerializeObject/DeserializeObject methods. Once retrieved, you could apply the persisted values in each of the nodes in the datastructure to the corresponding nodes in the TreeViewAdv on the form.

Please let me know if you have any queries.

Regards,
Hema



KS Keith Steinbeck August 12, 2008 07:01 PM UTC

Thanks for the reply but I'm a bit unclear on the process. Could you provide a simple sample to get me started in the right direction?

Keith



AD Administrator Syncfusion Team August 13, 2008 07:22 AM UTC

Hi Keith,

Thanks for choosing Syncfusion products.

We do have the AppStateSerializer's SerializeObject/DeserializeObject methods to save/load any control on a form.

Please refer the below sample.
http://websamples.syncfusion.com/samples/Tools.Windows/F75831/main.htm

Which shows how to do this on a TextBox. This can be adapted to the TreeViewAdv as well.

Please let me know if any concerns.

Regards,
Hema


Loader.
Live Chat Icon For mobile
Up arrow icon