I am trying to replace the node tree with the extension node (parent node). Replacement works fine. But expansion does not occur. You have a job?
Code below:
<asp:TreeView ID="tvContentTree" runat="server" RootNodeStyle-CssClass="RootAllKeys" ParentNodeStyle-CssClass="ParentAllKeys" ShowCheckBoxes="All" ImageSet="Simple" NodeIndent="10" OnTreeNodeExpanded="Populate_Node" > <HoverNodeStyle Font-Underline="True" ForeColor="#DD5555" /> <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="0px" NodeSpacing="0px" VerticalPadding="0px" /> <ParentNodeStyle Font-Bold="False" /> <SelectedNodeStyle Font-Underline="True" ForeColor="#DD5555" HorizontalPadding="0px" VerticalPadding="0px" /> </asp:TreeView> public void Populate_Node(Object sender, TreeNodeEventArgs e) { foreach (System.Web.UI.WebControls.TreeNode tn in tvContentTree.Nodes) { tn.ChildNodes.RemoveAt(1); tn.ChildNodes.AddAt(1,ParentNode); } }
if i comment the line
"tn.ChildNodes.RemoveAt (1);"
Then the extension works fine. Therefore, the removeat function causes a problem.
SmartestVEGA
source share