views:

39

answers:

2

I have developed a site using the TreeView control in Visual Studio 2008.

When I try to run it, it only displays lines of text, with no treeview formatting.

Is their something obvious I am missing here?

A: 

Two things come to mind -

  1. Have you got any hierarchy in your data (so that you get the tree)
  2. Have you defined any values for properties such as NodeIndent, ExpandImageUrl, CollapseImageUrl, NoExpandImageUrl etc. This may not be relevant as there are good defaults for them.

Check this article for Tree View Quick Starts.

VinayC
A: 

A sample code to display

<asp:TreeView ID="TreeView1" Runat="server">
<Nodes>
<asp:TreeNode Value="Parent1" Expanded="True" Text="1">
  <asp:TreeNode Value="Child1A" Text="A" />
    <asp:TreeNode Value="Child1B" Text="B" />
</asp:TreeNode>
<asp:TreeNode Value="Parent2" Text="2">
</asp:TreeNode>
<asp:TreeNode Value="Parent3" Expanded="True" Text="3">
  <asp:TreeNode Value="Child3A" Text="A">
  </asp:TreeNode>
</asp:TreeNode>

Dorababu