Solved

custom tree view

Posted on 2013-01-15
2
247 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
[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:
agarwalrahul earned 500 total points
ID: 38781490
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 38787455
tks
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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