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
this JavaScript function fix the tree :