Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:13:17+00:00 2026-06-15T11:13:17+00:00

i have an asp.net treeView. on node expanded i’m binding child nodes for the

  • 0

i have an asp.net treeView.
on node expanded i’m binding child nodes for the expanded node.
But if i check the node and than expand it, the node and all it’s child change there position and become like childs to the main node. when clicking again on the + it takes the right place.
Any idea on how to solve it!!!

that’s the tree in an updatePanel

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <asp:TreeView ID="MyTreeView" runat="server" ImageSet="XPFileExplorer" NodeIndent="15"
    OnTreeNodeExpanded="MyTreeView_TreeNodeExpanded">
    <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
    <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="2px"
        NodeSpacing="0px" VerticalPadding="2px" />
    <ParentNodeStyle Font-Bold="False" />
    <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
        VerticalPadding="0px" />
</asp:TreeView>

        </ContentTemplate>
</asp:UpdatePanel>

from the code behind:
on page load i have :

if (!this.IsPostBack)
            {
                this.MyTreeView.ShowCheckBoxes = TreeNodeTypes.All;
                this.MyTreeView.ShowLines = true;
                FillTree();//custom method just to fill the tree
            }

and

    protected void MyTreeView_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
    {
        TreeNode expandedNode = e.Node;

        if (expandedNode.Value != "-1" && expandedNode.Value == "-2")
        {
            //Some logic
        }

    }

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:13:19+00:00Added an answer on June 15, 2026 at 11:13 am

    this JavaScript function fix the tree :

    function FixTreeview(treeView) {
                try {
                    if (treeView) {
                        var treeLinks = treeView.getElementsByTagName("a");
                        var nodeCount = treeLinks.length;
                        for (i = 0; i < nodeCount; i++) {
                            if (treeLinks[i].firstChild.tagName) {
                                if (treeLinks[i].firstChild.tagName.toLowerCase() == "img") {
                                    var currentToggleLink = treeLinks[i];
                                    var childContainer = GetParentByTagName("table", currentToggleLink).nextSibling;
                                    try {
                                        eval(currentToggleLink.href);
                                    } catch (e) {
                                    }
                                }
                            }
                        } 
                    }
                } catch (e) {
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've used the following js code to expand/collapse all nodes of an ASP.Net TreeView
I have a ASP.Net TreeView Control with Checkboxes along Child nodes. I want to
i have a databound treeview in asp.net. how can i expand the root node
I have an ASP.net TreeView control which displays a hierarchical folder structure. Each node
I have a ASP.Net TreeView control that I am binding to an XML data
I have a requirement to create a multi level treeview in ASP.Net (with VB)
I have listed data for ASP.net control TreeView. I wanted to disable a particular
I using TreeView with ShowCheckBoxes=All in an ASP.NET 3.5 web application and for some
I have an ASP.NET MVC application that has a jQuery Treeview and a jQuery
I have an ASP.NET TreeView and need set ShowLine true when I define its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.