Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 29th, 2004, 11:34 AM
Registered User
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to NomAnor
Default Drop down Box

Ok here is the deal, i have a page that our users can goto and it will list out all of the files that are contained in a set of folders. It works great and they all really like having access to the reports without having to have paper all over (paper bad). However as we have continued using it the page is getting VERY long and it takes a good deal of scrolling to get through the entire page. This has prompted my boss to ask if we can change it so that all of the reports that are in different folders will be listed in a drop down box so that a user would just have several drop down boxes in front of them, click the one for the report they want and then choose the report that they need. As i said the code below is working and does what it was intended to, however my efforts to modify it have not been at all successful so i was wondering if someone else has a take on it, i have italicized the part that i believe needs to be modified. Any suggestions are much appreciated.


Code:
<br><br><br>
<center><table class=middle_page>
    <tr><td>
    <center><span class=text>Welcome, To Reports Site.</span></center>
    <br>

    <br>
    <center><span class=text>You currently have access to these reports...</span></center>

    <%
        RESPONSE.WRITE "<TABLE CLASS=LEFT_SIDE>"
        'section for viewing only links for current user...
        'session("location") = "1000"

        dim filesys, f 
        Set filesys = CreateObject("Scripting.FileSystemObject")

        Set f = filesys.GetFolder("c:\inetpub\wwwroot\reports\")

        'Response.Write ("Your folder was created on " & f.DateCreated)
        Set objfolders = f.subfolders




            for each objfolder in objfolders
                set objfolder1 = objfolders.item((objfolder.name))

                'if len(session("group")) > 0 then 
                        response.write "</table></center><center><table class=left_side><tr><td class=text>" & objfolder1.name & "</td><td class=text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Available Links</td></tr>"

                        for each objfile in objfolder1.files
                            if instr(1,ucase(objfile),".PDF") or instr(1,ucase(objfile),".DWF") or instr(1,ucase(objfile),".EXE")  or instr(1,ucase(objfile),".HTM") or instr(1,ucase(objfile),".XLS") or instr(1,ucase(objfile),".ASP") or instr(1,ucase(objfile),".DOC") or instr(1,ucase(objfile),".XLS") then
                                response.write "<TR><TD>&nbsp;&nbsp;</TD><TD CLASS=INPUT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='REPORTS/"  & objfolder1.name & "/" & ucase(objfile.name)  & "' target='notes'>" &  ucase(objfile.name)  & "</a></TD></TR>"
                            end if
                        next
                        response.write "<BR>"
                'end if

                'exit for
            next
        RESPONSE.WRITE "</TABLE></CENTER>"
    %> 
    <br><br>

    <br>
</td></tr></table></center>
 
Old March 29th, 2004, 12:01 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Hi

Why not create another page with the dropdowns that use FSO to read all the folders and add them to the list (Similar to how you reading the files) Once selected you pass the variable to the second page replacing the variabe as your root folder of the FSO.

e.g Set f = filesys.GetFolder("c:\inetpub\wwwroot\reports\") will become Set f = filesys.GetFolder("C:\" & SomeVArFromOtherPage)

This would probably be the quickest solution. Let me know if u need more information.
 
Old March 29th, 2004, 12:21 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

You could also look at the last post in this topic: http://p2p.wrox.com/topic.asp?TOPIC_ID=6803

These 2 files (Browse.asp & Show.asp) will display folders as hyperlinks which links to the files.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dyamic Drop Down Box edwarjw Beginning PHP 1 August 16th, 2007 11:39 PM
drop down box selected value crmpicco HTML Code Clinic 1 March 31st, 2005 09:56 AM
drop down select box shoakat Classic ASP Databases 1 February 10th, 2005 04:42 AM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.