Solved

tree view in .net

Posted on 2009-07-01
1
203 Views
Last Modified: 2013-11-07
Hi

I have created a tree view (see code section)

In which there is a root element called "$".

Now I want add nodes in this root column programatically. How can I do that in vb.net

<asp:TreeView ID = "tvMain" ExpandDepth = "0" PopulateNodesFromClient = "true" ShowLines = "true" 
                            ShowExpandCollapse = "true" runat = "server" CollapseImageUrl = "~/images/Folder.JPG" 
                            ExpandImageUrl = "~/images/FolderExpanded.JPG">
                            <Nodes>
                                 <asp:TreeNode Text="$" ImageUrl = "~/images/Folder.JPG">
                                     <asp:TreeNode Text="$" ImageUrl = "~/images/Folder.JPG">                                 
                                    </asp:TreeNode>
                                </asp:TreeNode>
                            </Nodes>
                        </asp:TreeView>

Open in new window

0
Comment
Question by:KaranGupta
1 Comment
 
LVL 20

Accepted Solution

by:
ddayx10 earned 500 total points
ID: 24752488
   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'just doing this so we dont add nodes every time posted back, completely optional
        'pick your poison from below
        If Not IsPostBack Then
            'Adds another child to the parent
            tvMain.Nodes(0).ChildNodes.Add(New TreeNode("$", "255", "~/images/Folder.JPG"))

            'Adds another node to the parent level
            tvMain.Nodes.Add(New TreeNode("$", "255", "~/images/Folder.JPG"))
        End If
    End Sub
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTTPS jquery doesn't work 9 62
Javascript to set controls visibility 5 36
What can cause the styling on a .NET site to not be found? 17 26
C# Gridview 1 33
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question