I continue to receive e-mails from developers wondering how to fix an irritating problem with TreeView controls bound to site maps: namely, how to preserve the state of the TreeView as a user clicks around the site.
The solution is documented in my latest Wicked Code column in MSDN Magazine. My solution involves recording the state of the TreeView in session state and using that information to make the next TreeView look like the last. To mitigate the problem of the increased number of postbacks, you can use an Atlas UpdatePanel control. Check it out if you’re using TreeViews to render navigational UIs and have run into this problem yourself.