Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

custom tree view

Posted on 2013-01-15
2
Medium Priority
?
270 Views
Last Modified: 2013-01-17
Trying to render my server side code to look like my html example. Main problem, I want to have my files (( filePaths )) load also but this is not working in my for each loop.


HTML example
<ul id="browser" class="filetree treeview-famfamfam">
					<%--<li><span class="folder">State</span>
					<ul>
						<li><span class="folder"><asp:label runat="server" ID="Month1" Text="January_2013" ></asp:label></span>
							<ul id="folder21">
								<li><span class="file">01/04/13 - 01/07/13 <span style="color:red;">Current</span></span></li>
							</ul>
						</li>
									
			</ul>

Open in new window



server side code example
 If Not IsPostBack Then

            sb.Append("<ul id=""browser"" class=""filetree treeview-famfamfam"">")

            Dim StateList As String() = Directory.GetDirectories(Server.MapPath("statements/"))
            Dim filePaths As String() = Directory.GetFiles(Server.MapPath("statements"))
            For Each mylist As String In StateList
                sb.Append("<ul><li><span class=""folder"">").Append(mylist)
                GetDirectories(mylist)
                sb.Append("</span>")
                sb.Append("<ul>")
                sb.Append("<li><span class=""file"">" & "filePaths" & "<span style=""color:red;"">Current</span></span></li>")

            Next
            '   sb.Append("<ul>")
        End If
        sb.Append("</ul>")
        longlist.Text = (sb.ToString())


Private Sub GetDirectories(ByVal path As String)
        'use try catch since some directories may not allow you to read the subfolders eg:your antivruses Quarantine folder
        Try
            Dim directoryList As String() = System.IO.Directory.GetDirectories("statement")
            If directoryList.Length > 0 Then
                sb.Append("<ul>")
                For Each directory As String In directoryList
                    sb.Append("<li>").Append(directory)
                    GetDirectories(directory)
                    sb.Append("</li>")
                Next
                sb.Append("</ul>")
            End If

        Catch
        End Try
    End Sub

Open in new window

0
Comment
Question by:Seven price
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
Rahul Agarwal earned 2000 total points
ID: 38781490
0
 
LVL 9

Author Closing Comment

by:Seven price
ID: 38787455
tks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

721 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