Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ASP in HTML 1

Status
Not open for further replies.

golyg

Programmer
Jul 22, 2002
319
US
Hi all,
This site is sooo helpful...

Currently I am displaying a group of folders on a page with this statement:
Response.Write (&quot;<TD>&quot; & sFont & oSubFolder.name & sEFont & &quot;</TD>&quot;)

But I want to display it in a directory listcontrol and this does not seem to work:

<SELECT id=select1 name=select1>
<OPTION>
<%=Response.Write (&quot;<TD>&quot; & sFont & oSubFolder.name & sEFont & &quot;</TD>&quot;)%>
</OPTION>
</SELECT>


any suggestions???


thanks in advance.
 
Code:
<SELECT id=select1 name=select1>
<OPTION>
<%=oSubFolder.name%>
</OPTION>
</SELECT>
Tony
reddot.gif WIDTH=400 HEIGHT=2 VSPACE=3

 
thanks alot,

I place a function in that <SELECT> statement in order for it to display all the folders in the listbox and instead it lists all the html source?

something like this:

<SELECT size=1 id=select1 name=select1>
<OPTION>
<%=ListDir(sDir)%>
</OPTION>
</SELECT>
 
Remove the <TD> tags and the font tags. I do not believe you are able to change the text color of the data in the listbox. Also, remove the = before the Response.Write.

Thanks,

Gabe
 
Thanks,
Actually I'm doing this in a for statement so right now there are alot of text-boxes. I want to do it in 1 textbox.
I'm trying to call the function in a HTML statement so they all show up in 1 textbox


thanks
 
If you continue to have trouble, post your code and I will take a look at it.

Thanks,

Gabe
 
Thanks Gabe..
Here it is, I hope the format is OK.
What I dream of it doing is creating a directory list control in which will display folders and then the user will be able to upload/download files.
Sort of like Windows Explorer...

We all have dreams..
-------------------------------------------

<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>

<%
'--- Module: DIRWALKR.ASP
'---
'---
Option Explicit
%>

<HTML>
<HEAD>
<TITLE>Directory Walk</TITLE>
</HEAD>
<BODY BGCOLOR=&quot;#ffffff&quot;>
<H2><CENTER>
FileManager Recursive Directory Walk
</CENTER></H2>
<CENTER>
<%
Dim sDirectory
Dim sFont
Dim sEFont

'---
'--- Change these settings to customize this example
'---
sDirectory = Session(&quot;FILE_ROOT&quot;)
sFont = &quot;<FONT SIZE=&quot;&quot;1&quot;&quot; FACE=&quot;&quot;arial&quot;&quot;>&quot;
'---
'--- End of customized settings
'---
sEFont = &quot;</FONT>&quot;

Sub ShowDirectory (sDirectory)
'--- This will show a nested set of tables containing the directory hierarchy.
Dim oFM
Dim oFolder
Dim oSubFolders
Dim oSubFolders2
Dim oSubFolder
Dim oFiles
Dim oFiles2
Dim oFile

Set oFM = Server.CreateObject(&quot;IRC.FileManager&quot; )
Set oFolder = oFM.GetFolder(sDirectory)
Set oSubFolders = oFolder.SubFolders
Set oFiles = oFolder.Files
If (oSubFolders.Count > 0) Or (oFiles.Count >0)Then
Response.Write(&quot;<TABLE WIDTH=&quot;&quot;100%&quot;&quot; BORDER=&quot;&quot;0&quot;&quot;>&quot;)

For each oSubFolder in oSubFolders
Response.Write (&quot;<TR>&quot;)
%>
<SELECT size=1 id=select1 name=select1>
<OPTION>
<%=Response.Write (oSubFolder.name)%>
</OPTION>
</SELECT>
<%

'Response.Write (&quot;<TD>&quot; & sFont & oSubFolder.name & sEFont & &quot;</TD>&quot;)
Response.Write (&quot;<TD>&nbsp;</TD>&quot;)
Response.Write (&quot;</TR>&quot; & vbCrLf)
'--- Does the subdirectory contain more directories or files?
Set oSubFolders2 = oSubFolder.SubFolders
Set oFiles2 = oSubFolder.Files
If (oSubFolders2.Count > 0) Or (oFiles2.Count > 0) Then
Response.Write (&quot;<TR><TD VALIGN=&quot;&quot;TOP&quot;&quot;><IMG SRC=&quot;&quot;dir.gif&quot;&quot; ALIGN=&quot;&quot;LEFT&quot;&quot;></TD><TD>&quot;)
ShowDirectory(oSubFolder.ParentFolder & &quot;\&quot; & oSubFolder.name)
Response.Write (&quot;&nbsp;</TD></TR>&quot; & vbCrLf)

End If
Set oSubFolders2 = nothing
Set oFiles2 = nothing
Next

For each oFile in oFiles
Response.Write (&quot;<TR>&quot;)
Response.Write (&quot;<TD>&quot; & sFont & oFile.Name & sEFont & &quot;</TD>&quot;)
Response.Write (&quot;</TR>&quot; & vbCrLf)
Next

Response.Write(&quot;</TABLE>&quot;)
End If
Set oSubFolder = nothing
Set oFiles = nothing
Set oFolder = nothing
Set oFM = nothing
End Sub

ShowDirectory(sDirectory)

%>

</CENTER>
</BODY>
</HTML>
 
Thanks Gabe..
Here it is, I hope the format is OK.
What I dream of it doing is creating a directory list control in which will display folders and then the user will be able to upload/download files.
Sort of like Windows Explorer...

Right now, I'm just using a textarea

We all have dreams..
-------------------------------------------
<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>

<%
'--- Module: DIRWALKR.ASP
'---
'---
Option Explicit
%>

<HTML>
<HEAD>
<TITLE>Directory Walk</TITLE>
</HEAD>
<BODY BGCOLOR=&quot;#ffffff&quot;>
<H2><CENTER>
FileManager Recursive Directory Walk
</CENTER></H2>
<CENTER>
<%
Dim sDirectory
Dim sFont
Dim sEFont

'---
'--- Change these settings to customize this example
'---
sDirectory = Session(&quot;FILE_ROOT&quot;)
sFont = &quot;<FONT SIZE=&quot;&quot;1&quot;&quot; FACE=&quot;&quot;arial&quot;&quot;>&quot;
'---
'--- End of customized settings
'---
sEFont = &quot;</FONT>&quot;

Sub ShowDirectory (sDirectory)
'--- This will show a nested set of tables containing the directory hierarchy.
Dim oFM
Dim oFolder
Dim oSubFolders
Dim oSubFolders2
Dim oSubFolder
Dim oFiles
Dim oFiles2
Dim oFile

Set oFM = Server.CreateObject(&quot;IRC.FileManager&quot; )
Set oFolder = oFM.GetFolder(sDirectory)
Set oSubFolders = oFolder.SubFolders
Set oFiles = oFolder.Files

If (oSubFolders.Count > 0) Or (oFiles.Count >0)Then
Response.Write(&quot;<TABLE WIDTH=&quot;&quot;100%&quot;&quot; BORDER=&quot;&quot;0&quot;&quot;>&quot;)

For each oSubFolder in oSubFolders
Response.Write (&quot;<TR>&quot;)
%>
<TEXTAREA rows=2 cols=20 id=textarea1 name=textarea1>
<%=Response.Write (oSubFolder.name)%>
</TEXTAREA>
<%

'Response.Write (&quot;<TD>&quot; & sFont & oSubFolder.name & sEFont & &quot;</TD>&quot;)

Response.Write (&quot;<TD>&nbsp;</TD>&quot;)
Response.Write (&quot;</TR>&quot; & vbCrLf)

'--- Does the subdirectory contain more directories or files?
Set oSubFolders2 = oSubFolder.SubFolders
Set oFiles2 = oSubFolder.Files

If (oSubFolders2.Count > 0) Or (oFiles2.Count > 0) Then
Response.Write (&quot;<TR><TD VALIGN=&quot;&quot;TOP&quot;&quot;><IMG SRC=&quot;&quot;dir.gif&quot;&quot; ALIGN=&quot;&quot;LEFT&quot;&quot;></TD><TD>&quot;)
ShowDirectory(oSubFolder.ParentFolder & &quot;\&quot; & oSubFolder.name)
Response.Write (&quot;&nbsp;</TD></TR>&quot; & vbCrLf)
End If

Set oSubFolders2 = nothing
Set oFiles2 = nothing
Next

For each oFile in oFiles
Response.Write (&quot;<TR>&quot;)
Response.Write (&quot;<TD>&quot; & sFont & oFile.Name & sEFont & &quot;</TD>&quot;)
Response.Write (&quot;</TR>&quot; & vbCrLf)
Next
Response.Write(&quot;</TABLE>&quot;)

End If

Set oSubFolder = nothing
Set oFiles = nothing
Set oFolder = nothing
Set oFM = nothing
End Sub

ShowDirectory(sDirectory)

%>

</CENTER>
</BODY>
</HTML>
 
I apologize but I am not going to be able to look at this right now.

I do have a suggestion though. Setup a free account with Go to their file manager section.

It does almost exactly what you are looking for. Maybe will give you some ideas and inspiration.

Thanks,

Gabe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top