?
Solved

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

Posted on 2006-11-27
4
Medium Priority
?
227 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 2000 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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

771 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