Windows Explorer type setup using asp?

Results 1 to 3 of 3

Thread: Windows Explorer type setup using asp?

  1. #1
    Join Date
    Dec 1969

    Default Windows Explorer type setup using asp?

    Please forgive me for asking such a vague and silly question, but I&#039;m trying to work out a way of creating a folder structure using asp, analogous to the folders in Windows Explorer. <BR><BR>At the moment I&#039;m using parent_IDs, so I&#039;ve got an Access db with the following fields:<BR><BR>catID<BR>catTitle<BR>CatID_Parent<B R><BR>So I can have say a root folder called &#039;Bicycle&#039; with a catID of 1, and a catID_PArent of zero to denote the root folder. <BR><BR>I can then have subfolders/categories called say &#039;Training&#039;, &#039;Maintainance&#039; etc, and for each one I would put 1 in the catID_Parent field, thus linking them up with the maintainance folder. <BR><BR>I could then have the folders being nested, so that if the catID of the &#039;Training&#039; folder was 6 then I could have subfolders of &#039;whatever&#039; with 6 int the catID_Parent field. <BR><BR>and so on. <BR><BR>Does this seem logical? I&#039;m just coming to look at how to browse the structure in ASP, which is where I&#039;m getting stuck. I can have each folder being a link, and then see the folders inside the other folders, but it&#039;s limited because if I look in the &#039;Maintainance&#039; folder I can&#039;t see all the other folder on the same level, as you can in WinExplorer. <BR><BR>Alternatively, if anyone is aware of a resource out there which approaches this far better than my stupid code does, I&#039;d appreciate any info. <BR><BR>Thanks for your time<BR><BR>j

  2. #2
    Join Date
    Dec 1969

    Default You want an interface..

    .. kind of like this messageboard, right?<BR><BR>There are a few ways of going about it. I personally used the method that you described. I developed a set of stored procedures to "quasi-"recursively loop through the table to get the whole tree and I could then loop through it and display the contents. It was a mess of a stored procedure, but I got the base of it out the Books Online.<BR><BR>There is an article(s) on that handle hierarchies (I might have even posted my SP on the forums, name: dsetzer). Try searching over there.

  3. #3
    Join Date
    Dec 1969

    Default Here's the code you need

    Here&#039;s how I solved... it i member_of instead of catid_parent... it prints the treestructure into a selectbox... some of the var&#039;s are in dutch<BR><BR>function ZoekOnderdelen(input)<BR> dim z,n,i,spaces<BR> dim sqlZoekOnderdelen<BR> dim rsResultsOnderdelen<BR> dim objDBConnResultsOnderdelen<BR> set objDBConnResultsOnderdelen = server.CreateObject("ADODB.Connection")<BR> set rsResultsOnderdelen = Server.CreateObject("ADODB.Recordset")<BR> z = input<BR> sqlZoekOnderdelen = "select * from subject where member_of = convert(uniqueidentifier,&#039;" & z & "&#039;) and user_id = &#039;" & Session("userid") & "&#039;"<BR> objDBConnResultsOnderdelen.Open Session("ConnectionString")<BR> rsResultsOnderdelen.Open sqlZoekOnderdelen, objDBConnResultsOnderdelen, 1<BR> if rsResultsOnderdelen.RecordCount &#062; 0 then<BR> do while not rsResultsOnderdelen.EOF<BR> inspring = inspring + 1<BR> spaces = spaces & "&nbsp&nbsp&nbsp"<BR> for i = 1 to inspring<BR> spaces = spaces & "&nbsp&nbsp&nbsp"<BR> next<BR> tmpStrZoekOnderdelen = tmpStrZoekOnderdelen & "&#060;OPTION VALUE=""" & rsResultsOnderdelen("subject_id") & """&#062;"<BR> tmpStrZoekOnderdelen = tmpStrZoekOnderdelen & spaces & rsResultsOnderdelen("subject_discription") & "&#060;/OPTION&#062;" & vbcrlf<BR> spaces = ""<BR> ZoekOnderdelen(rsResultsOnderdelen("subject_id"))< BR> rsResultsOnderdelen.MoveNext<BR> loop<BR> end if<BR> inspring = 0<BR> &#039;spaces = ""<BR> set rsResultsOnderdelen = nothing<BR> set objDBConnResultsOnderdelen = nothing<BR> ZoekOnderdelen = tmpStrZoekOnderdelen<BR>end function<BR><BR>function GetVakken <BR> dim objDBConnGV<BR> dim sqlGetNull<BR> dim rsGetNull<BR> dim tempGetVakkenKey<BR> dim TempGetVakkenString<BR> dim first<BR> first = true<BR> <BR> TempGetVakkenString = "&#060;SELECT NAME=""VAKKEN"" SIZE=""25""&#062;" & vbcrlf<BR> <BR> Set objDBConnGV = Server.CreateObject("ADODB.Connection") <BR> objDBConnGV.Open Session("ConnectionString") <BR><BR> Set rsGetNull = Server.CreateObject("ADODB.Recordset")<BR><BR> sqlGetNull = "select * from subject where member_of is null and user_id = &#039;" & Session("userid") & "&#039;"<BR><BR> rsGetNull.Open sqlGetNull, objDBConnGV, 1<BR><BR> if rsGetNull.RecordCount &#062; 1 then<BR> do while not rsGetNull.EOF<BR> tmpStrZoekOnderdelen = ""<BR> tempGetVakkenkey = rsGetNull("subject_id")<BR> if not first then<BR> TempGetVakkenString = TempGetVakkenString & "&#060;OPTION VALUE=""empty""&#062;&#060;/OPTION&#062;"<BR> end if<BR> TempGetVakkenString = TempGetVakkenString & "&#060;OPTION VALUE=""" & rsGetNull("subject_id") & """&#062;" & rsGetNull("subject_discription") & "&#060;/OPTION&#062;" & vbcrlf<BR> first = false<BR> TempGetVakkenString = TempGetVakkenString & ZoekOnderdelen(tempGetVakkenKey)<BR> rsGetNull.MoveNext<BR> loop<BR> end if<BR><BR> if rsGetNull.RecordCount = 1 then<BR> TempGetVakkenString = TempGetVakkenString & "&#060;OPTION VALUE=""" & rsGetNull("subject_id") & """&#062;" & rsGetNull("subject_discription") & "&#060;/OPTION&#062;" & vbcrlf<BR> end if<BR> <BR> if rsGetNull.RecordCount &#060; 1 then<BR> GetVakken = "Je hebt nog geen vakken aangemaakt"<BR> end if <BR> <BR> set objDBConnGV = nothing<BR> set sqlGetNull = nothing<BR> set rsGetNull = nothing<BR> <BR> TempGetVakkenString = TempGetVakkenString & "&#060;/SELECT&#062;" & vbcrlf<BR> GetVakken = TempGetVakkenString<BR>end function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts