How to make webcontrols.treeView Return Automatically to the node checked after an  event

Posted on 2009-02-11
Last Modified: 2012-05-06
I've got a treeview webcontrol on a webpage with a long list of items.  When a user clicks on an item it places an image icon next to that item.  It does this after posting back to the server because of the selectedNodeChange event and getting the image icon.   However, the treeview then scrolls back automatically to the top of the tree instead of staying put where the user clicked on the node.   So then the user has to scroll all the way back down to where they left off.  

My question is:   how can I keep the treeview scrolled down to the where the last node was clicked on by the user after the postback?   I thought this was automatic but it is not.

Thanks in advance.
Question by:jonmclean2
    LVL 15

    Accepted Solution

    The solution was to delete SmartNavigation="true"  from the page directive (first line of the ASPX page) and add  add
    LVL 26

    Expert Comment

    by:Anurag Thakur
    LVL 1

    Author Comment


    Well, that didn't work.  MaintainScrollPositionOnPostback only works for an entire page view but it has no effect on a treeview that is inside of a panel.   Close but no cigar.    :)
    LVL 1

    Author Comment

    Hi Ragi0017,

    I think those instructions only work on a windows treeview control but not on a web treeview control.  Those methods were not available on the web control is what I meant to say.
    LVL 1

    Author Closing Comment

    Actually, I decided to remove my treeview from the panel and place it directly on the page just so I could use the instruction you gave me.  It was a heck of a lot easier to redesign the page around this change than trying to keep it in the panel.   So I thank you very much!!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
    A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    760 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

    10 Experts available now in Live!

    Get 1:1 Help Now