This project is read-only.

Having trouble adding a treeview to a page

Jan 27, 2009 at 9:56 PM
Nice piece of code.

I have been trying add a treeview to a new page I have added and am running into a problem. The treeview initially populates correctly with the parent and child nodes viewable. However, when I click on any member of the tree view the contents of the treeview are deleted when the page redraws!

If I put the same code, C# and html, into a completely seperate test application it all works OK. So I'm thinking its something to do with the Blog Engine, any ideas ?
Jan 27, 2009 at 9:59 PM
Here is my html and test C# code:


<asp:TreeView ID="TreeView1" runat="server" Height="287px"



ImageSet="XPFileExplorer" NodeIndent="15"



onselectednodechanged="TreeView1_SelectedNodeChanged" Width="176px">



<ParentNodeStyle Font-Bold="False" />



<HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />



<SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False"



HorizontalPadding="0px" VerticalPadding="0px" />



<NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black"



HorizontalPadding="2px" NodeSpacing="0px" VerticalPadding="2px" />




Andhere is the C# code:



protected void Page_Load(object sender, EventArgs e)




if (!Page.IsPostBack)







private void PopulateTree()














private void AddNode(string t)




TreeNode tn = new TreeNode();


tn.Text =



tn.Value = t;



TreeNode c = new TreeNode();


c.Text =

"hi c";


c.Value = t;