Solved

custom tree view

Posted on 2013-01-15
2
213 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:sevensnake77
2 Comments
 
LVL 13

Accepted Solution

by:
agarwalrahul earned 500 total points
ID: 38781490
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 38787455
tks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

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

12 Experts available now in Live!

Get 1:1 Help Now