TreeView & AutoPostBack ?

Posted on 2006-05-24
Last Modified: 2008-02-01
I'm using the 2.0 version of the <asp:treeview /> in a page of mine.  I want the user to just select a node and hit another button outside of the treeview.  However when they select the node, the entire page posts back.  I don't want this to occur.  Is there any way to configure the TreeView to not postback when they select a node, but still be able to determine what they selected when they click this other button?

I don't see any option to control this.
Question by:raterus
    LVL 19

    Accepted Solution

    It used to be that <asp:treeview AutoPostBack=false /> would work, but as it seems that doesn't work anymore.

    I don't think there is an option to selecting a node without a postback now. Selecting a node in the tree will cause a postback immediately.

    However, there is almost always a workaround and that seems to be the case here as's not pretty, but it seems to be workable.. ;)

    <asp:TreeView ID="TreeView1" runat="server" Target="_self">
        <asp:TreeNode Text="One" NavigateUrl="javascript:void(0)" />
        <asp:TreeNode Text="Two" NavigateUrl="javascript:void(0)" />
      <SelectedNodeStyle Font-Bold="True" />

    Why does it do this?  It works this way because if the Target of the NavigateUrl is not the current page (e.g. Target=_blank or Target=SomeFrame), then the page isn’t going to change.  Therefore, it needs to mark the current item as selected.

    I hope this helps,

    LVL 19

    Expert Comment

    Are you still there raterus?

    LVL 33

    Author Comment

    Yeah, swamped with work, as usual.

    I'm sure this solution will work as desired, since I can understand what you're doing, I never got around to testing it.  The asp:treeview was doing some very weird things that I looked at fixing for about a half-day, and eventually opted to trash using the control altogether, in favor of another control...with it's own quirks.

    Thank you though for your help!
    LVL 19

    Expert Comment

    You are welcome :)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    794 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

    16 Experts available now in Live!

    Get 1:1 Help Now