Solved

tree view in .net

Posted on 2009-07-01
1
201 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
work allocation; web development; vba; access; 4 46
Hovering effect 9 30
C# Error - Add Failed 12 52
ASP.NET reading ATOM 2 27
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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:…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now