Solved

Save treeview viewstate and reload it after the treeview is rebuilt

Posted on 2004-09-13
5
613 Views
Last Modified: 2008-02-01
Hi Experts,

I use a treeview to display paths.
When user clicks a button, the treeview displays other paths from another datasource.
After that, the user can go back to the previous treeview, but if I reload it, the treeview is the same as first load : I mean the selected and expanded nodes are not the same as the user defined them previously.
That's why I want to know if it's possible to save the viewstate before the user changes my treeview and to reload this viewstate after I rebuilt the treeview.

Hope it's clear.
Thanks in advance for your answers.
0
Comment
Question by:noulouk
  • 3
5 Comments
 
LVL 17

Accepted Solution

by:
AerosSaga earned 250 total points
ID: 12044569
try this:

Protected Overrides Function SaveViewState() As Object

Viewstate("TreeView1") = Me.TreeView1

Return MyBase.SaveViewState()

0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12044586
0
 
LVL 10

Assisted Solution

by:jnhorst
jnhorst earned 250 total points
ID: 12046954
If you are using a button to send a postback that goes from one tree display to another, and you want to go back to the previous display, in that button's click event, save info about the selected node in the button's CommandArgument property.  When you reload the tree, you can use that info to select the node.  The info should be accessible in

Request.Form("__EVENTARGUMENT")

John
0
 
LVL 9

Author Comment

by:noulouk
ID: 12048315
I choose a different way to do what I want, but I think your answers are both available.
Thank you for your help.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12048338
your very welcome
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now