Solved

Do someone know Ajax treeview control that does not require to register component on server?

Posted on 2006-11-27
4
217 Views
Last Modified: 2007-03-20
Hi, we need Ajax treeview that does not require to registering component on server that can get server's files and folder?

Regards.
0
Comment
Question by:Abdu_Allah
[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
  • 3
4 Comments
 
LVL 25

Expert Comment

by:kevp75
ID: 18024698
you should be able to do this with a little javascript and some ASP code.  I mention this route, only because you would need to make sure that latest XML component is installed on the server if vying for a AJAX route.

If you decide to do the AJAX route, remember you will need at least 2 files to do it....while, a simple recursive directory function, and a show/hide script would do what you need...

Let me know, I'll throw together something in the mean while...
0
 
LVL 25

Expert Comment

by:kevp75
ID: 18024851
have a look here:
http://www.portalfanatic.com/temp/test7.asp

gimme a minute or 20 and I'll have that treeview
0
 
LVL 25

Accepted Solution

by:
kevp75 earned 500 total points
ID: 18025228
ok.....have a look at the test page...

http://www.portalfanatic.com/temp/test7.asp

here's the code:

<%Server.ScriptTimeout=90000%>
<script type="text/javascript">
window.onload = function gmpinit(){
      if (document.getElementById){
            if (document.images){
                  icons = new Image();
                  icons.src = "";
            }
            var eLink = document.createElement("link");
            eLink.rel = "stylesheet";
            eLink.type = "text/css";
            eLink.media = "all";
            eLink.href= "/style.css";
            document.body.appendChild(eLink);
            ULnodes = document.getElementById("treenav").getElementsByTagName("UL");
            len = ULnodes.length;
            for(var i = 1; i < len; i++){
                  var folder = ULnodes[i].parentNode.firstChild;
                  folder.onclick = gmptc;
                  folder.className = "fc";
            }
}      }
function gmptc(){
      var target = this.nextSibling.nextSibling.style;
      target.display = target.display=="block"?"none":"block";
      this.className = this.className == "fc"?"fo":"fc";
}
expand = false;
function gmpec(){
      for(var i = 1; i < len; i++){
            ULnodes[i].parentNode.firstChild.className = expand==false?"fo":"fc";
            ULnodes[i].style.display = expand==false?"block":"none";
      }
      expand = expand==false?true:false;
}
</script>
<div id="treenav">
<p><a class="command" href="#" onclick="gmpec('e')">Expand All</a>/<a class="command" href="#" onclick="gmpec('c')">Collapse All</a></p>
<ul id="treenav_root">
<% ListFolderContents(server.mappath("/temp/temp3/")) %>
</ul>
<% sub ListFolderContents(path)
     dim fs, folder, file, item, url
     set fs = CreateObject("Scripting.FileSystemObject")
     set folder = fs.GetFolder(path)
    'Display the target folder and info.
     Response.Write("<li><a href=""#""><b>" & folder.Name & "</b></a> - " _
       & folder.Files.Count & " files, ")
     if folder.SubFolders.Count > 0 then
       Response.Write(folder.SubFolders.Count & " directories, ")
     end if
     'Response.Write(Round(folder.Size / 1024) & " KB total." _
       '& vbCrLf)
     Response.Write("<ul>" & vbCrLf)
     'Display a list of sub folders.
     for each item in folder.SubFolders
       ListFolderContents(item.Path)
     next
     'Display a list of files.
     for each item in folder.Files
       url = MapURL(item.path)
       Response.Write("<li><a href=/music/""" & url & """>" & item.Name & "</a> - " & item.Size & " bytes, " & "last modified on " & item.DateLastModified & "." _
         & "</li>" & vbCrLf)
     next
     Response.Write("</ul>" & vbCrLf)
     Response.Write("</li>" & vbCrLf)
   end sub
      function MapURL(path)
     dim rootPath, url
     'Convert a physical file path to a URL for hypertext links.
     rootPath = Server.MapPath("/music/")
     url = Right(path, Len(path) - Len(rootPath))
     MapURL = Replace(url, "\", "/")
   end function
%>
   </div>


I am having a spot of trouble with getting the tree to be closed by default...any takers???
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 18026498
I am not asking about how we do it!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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