Solved

custom tree view

Posted on 2013-01-15
2
233 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

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
Error on Add method 1 50
Angular JS Route 3 68
C# Single Form 8 42
How do I prevent the pages in my site from showing up in a google search? 2 73
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

11 Experts available now in Live!

Get 1:1 Help Now