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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TreeViewAdv : How can I save the contents/state?

Thread ID:

Created:

Updated:

Platform:

Replies:

75831 Aug 11,2008 06:33 PM UTC Aug 13,2008 07:22 AM UTC WinForms 3
loading
Tags: Tools
Keith Steinbeck
Asked On August 11, 2008 06:33 PM UTC

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


Administrator [Syncfusion]
Replied On 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


Keith Steinbeck
Replied On 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


Administrator [Syncfusion]
Replied On 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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;