[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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/…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

650 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