|
 |
asp_databases thread: RE: Filling a combo box
Message #1 by "Michael W Pickens" <HO0MWP@F...> on Mon, 4 Mar 2002 12:43:16 -0500
|
|
I see what you mean about opening the pdf Colin. I don't know much about
JavaScript. I really only have XHTML, ASP, VB Script and VB Books
You have been a very big help. Thanks a lot.
Michael
Colin.Montgomery@C... on 03/04/2002 10:35:31 AM
Please respond to "ASP Databases" <asp_databases@p...>
To: "ASP Databases" <asp_databases@p...>
cc:
Subject: [asp_databases] RE: Filling a combo box
Michael,
Have a look at:
http://www.4guysfromrolla.com/ASPScripts/PrintFAQ.asp?FAQID=90
The virtual directory thing wasn't for security purposes. It would still
be
a published, read-only directory -users will be able get the file path
either way. It would make the process of uploading the PDFs to a server
easier, and take the storage strain away from the web server itself. It's
only really applicable if you're going to have loads of PDFs (i.e. GB's
worth) - otherwise just put them in a folder within your site, such as:
c:\inetpub\wwwroot\mySite\PDFdocs\ which would map to:
http://localhost/mySite/PDFdocs/ on your local machine.
You're going to need to use some JavaScript to get the PDF to open from the
combo box - <a href...> isn't going to be applicable.
HTH,
Col
-----Original Message-----
From: Michael W Pickens [mailto:HO0MWP@F...]
Sent: 04 March 2002 14:59
To: ASP Databases
Subject: [asp_databases] RE: Filling a combo box
Colin thanks for replying to my post. I appreciate you taking time out of
your busy schedule to tring and help. If anyone who is reading these knows
how to fill a combo box using the file names of pdfs on the directory of
the server I would much appreciate knowing the answer.
Colin, I have filled a combo box before using a recordset from a database.
So I am a little familiar with that. However, I have no idea on how to
find the names of the files on the web directory or on the C drive to
populate this combo box. I have never done this before and the books just
cover filling in a combo box using a recordset.
I am using PWS as this is just an intranet site. However, using the <A
ref> and the putting the files in the web directory it does not look like
it is giving the user the address of where the file is stored so I think it
is relatively safe right? Am I missing something here? I don't want the
users to have complete access to these files but to be able to view them.
M!
*******
This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure. If you are not the intended
recipient, please telephone or email the sender and delete this message and
any attachment from your system. If you are not the intended recipient you
must not copy this message or attachment or disclose the contents to any
other person.
For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.
$subst('Email.Unsub').
Message #2 by "Michael W Pickens" <HO0MWP@F...> on Mon, 4 Mar 2002 09:58:47 -0500
|
|
Colin thanks for replying to my post. I appreciate you taking time out of
your busy schedule to tring and help. If anyone who is reading these knows
how to fill a combo box using the file names of pdfs on the directory of
the server I would much appreciate knowing the answer.
Colin, I have filled a combo box before using a recordset from a database.
So I am a little familiar with that. However, I have no idea on how to
find the names of the files on the web directory or on the C drive to
populate this combo box. I have never done this before and the books just
cover filling in a combo box using a recordset.
I am using PWS as this is just an intranet site. However, using the <A
ref> and the putting the files in the web directory it does not look like
it is giving the user the address of where the file is stored so I think it
is relatively safe right? Am I missing something here? I don't want the
users to have complete access to these files but to be able to view them.
M!
Colin.Montgomery@C... on 03/04/2002 09:34:25 AM
Please respond to "ASP Databases" <asp_databases@p...>
To: "ASP Databases" <asp_databases@p...>
cc:
Subject: [asp_databases] RE: Filling a combo box
i'm not sure about how to return an array/recordset of all the files in a
particular directory on the server - hopefully someone else can help u out
with that - but I have a couple of pointers 4 u:
Consider storing your PDFs in a non-published directory. Then create a
virtual directory using IIS to point to this folder. This just allows you
more freedom to move the documents onto a storage server. This would have
the knockon effect that staff who upload the PDF files can map a drive on
their local machine and simply drag the files there - no need to have
access
to the Web server.
Also, you can't think of a combo box as being an object in ASP. What you
do
is use your ASP code to write out the necessary HTML for a combo box, using
your loop to add the necessary number of <OPTION VALUE tags (1 for each PDF
that is). E.g.
<OPTION VALUE="<%=rs(FileName)%>">
HTH,
Col
-----Original Message-----
From: Michael [mailto:michael.pickens@f...]
Sent: 04 March 2002 13:50
To: ASP Databases
Subject: [asp_databases] Filling a combo box
I have a combo box that I want to fill up with the name of pdf files that
will be stored in the "inetpub/wwwroot" folder. This way the user can
choose which file they want to see and then I can use the <a href> to
bring up the file for them. I have done this before in VB but never in
ASP. Below is what I tried but as you can guess it didn't work. The name
of my combo box is cboStores. Below is the code I tried which is what I
use in VB. Any suggestions would be greatly appreciated.
<SCRIPT Language = VBScript>
Const Folder1 = "C:\Stores"
Const ExtSpec1 = "*.pdf"
strFileName1 = Dir(Folder1 & ExtSpec1)
Do While Len(strFileName1)
strLength = Len(strFileName1) ' Get report name length
strDeleteRPT = strLength - 4
cboStores.AddItem Left(strFileName1, strDeleteRPT)
strFileName1 = Dir
Loop
</SCRIPT>
$subst('Email.Unsub').
*******
This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure. If you are not the intended
recipient, please telephone or email the sender and delete this message and
any attachment from your system. If you are not the intended recipient you
must not copy this message or attachment or disclose the contents to any
other person.
For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.
$subst('Email.Unsub').
Message #3 by "Drew, Ron" <RDrew@B...> on Mon, 4 Mar 2002 14:03:36 -0500
|
|
Once you are done with your code, other than the opening, pass it along.
Yes there are ways to open it, just keep in mind that the user must have
adobe as an association for the pdf extension for it to work. Maybe
just a mouse click that fires a new window with the pdf.
-----Original Message-----
From: Michael W Pickens [mailto:HO0MWP@F...]
Sent: Monday, March 04, 2002 1:29 PM
To: ASP Databases
Subject: [asp_databases] RE: Filling a combo box
Ron:
Thanks for responding. That is what I ended up using thanks to Steven
Broos who gave me the code a little bit earlier. However now I am
having the problem of taking what fills up in the combo box (cboStores)
and opening the corresponding pdf file. Any ideas?
Again thanks for responding and I am sorry I wasted your time. I sent
out a message right before I sent this one that you saw to Colin
thanking Steven for his code. That probally was a little confusing.
Michael
"Drew, Ron" <RDrew@B...> on 03/04/2002 01:22:21 PM
Please respond to "ASP Databases" <asp_databases@p...>
To: "ASP Databases" <asp_databases@p...>
cc:
Subject: [asp_databases] RE: Filling a combo box
Maybe FSO can help you.....
Function GetDirectoryList(FilenameDefault)
Dim objFSO,objFolder,objFile
Dim str
Set objFSO =3D Server.CreateObject("Scripting.FileSystemObject")
Set objFolder =3D objFSO.GetFolder(FILES_PATH)
str =3D ""
For Each objFile in objFolder.Files
if UCase(Right(objFile.Name,3)) =3D "pdf" then
str =3D str & "<option value=3D""" & objFile.Name & """"
if FilenameDefault=3DobjFile.Name then str =3D str & "
selected "
str =3D str & ">" & objFile.Name & "</option>"
End If
Next
Set objFSO =3D nothing
if str =3D "" then
GetDirectoryList =3D "<option>None</option>"
Else
GetDirectoryList =3D str
End If
End Function
-----Original Message-----
From: Colin.Montgomery@C...
[mailto:Colin.Montgomery@C...]
Sent: Monday, March 04, 2002 9:34 AM
To: ASP Databases
Subject: [asp_databases] RE: Filling a combo box
i'm not sure about how to return an array/recordset of all the files in
a particular directory on the server - hopefully someone else can help u
out with that - but I have a couple of pointers 4 u:
Consider storing your PDFs in a non-published directory. Then create a
virtual directory using IIS to point to this folder. This just allows
you more freedom to move the documents onto a storage server. This
would have the knockon effect that staff who upload the PDF files can
map a drive on their local machine and simply drag the files there - no
need to have access to the Web server.
Also, you can't think of a combo box as being an object in ASP. What
you do is use your ASP code to write out the necessary HTML for a combo
box, using your loop to add the necessary number of <OPTION VALUE tags
(1 for each PDF that is). E.g. <OPTION VALUE=3D"<%=3Drs(FileName)%>">
HTH,
Col
-----Original Message-----
From: Michael [mailto:michael.pickens@f...]
Sent: 04 March 2002 13:50
To: ASP Databases
Subject: [asp_databases] Filling a combo box
I have a combo box that I want to fill up with the name of pdf files
that will be stored in the "inetpub/wwwroot" folder. This way the user
can choose which file they want to see and then I can use the <a href>
to bring up the file for them. I have done this before in VB but never
in ASP. Below is what I tried but as you can guess it didn't work. The
name of my combo box is cboStores. Below is the code I tried which is
what I
use in VB. Any suggestions would be greatly appreciated.
<SCRIPT Language =3D VBScript>
Const Folder1 =3D "C:\Stores"
Const ExtSpec1 =3D "*.pdf"
strFileName1 =3D Dir(Folder1 & ExtSpec1)
Do While Len(strFileName1)
strLength =3D Len(strFileName1) ' Get report name length
strDeleteRPT =3D strLength - 4
cboStores.AddItem Left(strFileName1, strDeleteRPT)
strFileName1 =3D Dir
Loop
</SCRIPT>
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
$subst('Email.Unsub').
*******
This message and any attachment are confidential and may be privileged
or otherwise protected from disclosure. If you are not the intended
recipient, please telephone or email the sender and delete this message
and any attachment from your system. If you are not the intended
recipient you must not copy this message or attachment or disclose the
contents to any other person.
For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
$subst('Email.Unsub').
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
$subst('Email.Unsub').
$subst('Email.Unsub').
Message #4 by "Michael W Pickens" <HO0MWP@F...> on Mon, 4 Mar 2002 13:28:49 -0500
|
|
Ron:
Thanks for responding. That is what I ended up using thanks to Steven
Broos who gave me the code a little bit earlier. However now I am having
the problem of taking what fills up in the combo box (cboStores) and
opening the corresponding pdf file. Any ideas?
Again thanks for responding and I am sorry I wasted your time. I sent out
a message right before I sent this one that you saw to Colin thanking
Steven for his code. That probally was a little confusing.
Michael
"Drew, Ron" <RDrew@B...> on 03/04/2002 01:22:21 PM
Please respond to "ASP Databases" <asp_databases@p...>
To: "ASP Databases" <asp_databases@p...>
cc:
Subject: [asp_databases] RE: Filling a combo box
Maybe FSO can help you.....
Function GetDirectoryList(FilenameDefault)
Dim objFSO,objFolder,objFile
Dim str
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(FILES_PATH)
str = ""
For Each objFile in objFolder.Files
if UCase(Right(objFile.Name,3)) = "pdf" then
str = str & "<option value=""" & objFile.Name & """"
if FilenameDefault=objFile.Name then str = str & "
selected "
str = str & ">" & objFile.Name & "</option>"
End If
Next
Set objFSO = nothing
if str = "" then
GetDirectoryList = "<option>None</option>"
Else
GetDirectoryList = str
End If
End Function
-----Original Message-----
From: Colin.Montgomery@C...
[mailto:Colin.Montgomery@C...]
Sent: Monday, March 04, 2002 9:34 AM
To: ASP Databases
Subject: [asp_databases] RE: Filling a combo box
i'm not sure about how to return an array/recordset of all the files in
a particular directory on the server - hopefully someone else can help u
out with that - but I have a couple of pointers 4 u:
Consider storing your PDFs in a non-published directory. Then create a
virtual directory using IIS to point to this folder. This just allows
you more freedom to move the documents onto a storage server. This
would have the knockon effect that staff who upload the PDF files can
map a drive on their local machine and simply drag the files there - no
need to have access to the Web server.
Also, you can't think of a combo box as being an object in ASP. What
you do is use your ASP code to write out the necessary HTML for a combo
box, using your loop to add the necessary number of <OPTION VALUE tags
(1 for each PDF that is). E.g. <OPTION VALUE="<%=rs(FileName)%>">
HTH,
Col
-----Original Message-----
From: Michael [mailto:michael.pickens@f...]
Sent: 04 March 2002 13:50
To: ASP Databases
Subject: [asp_databases] Filling a combo box
I have a combo box that I want to fill up with the name of pdf files
that
will be stored in the "inetpub/wwwroot" folder. This way the user can
choose which file they want to see and then I can use the <a href> to
bring up the file for them. I have done this before in VB but never in
ASP. Below is what I tried but as you can guess it didn't work. The
name
of my combo box is cboStores. Below is the code I tried which is what I
use in VB. Any suggestions would be greatly appreciated.
<SCRIPT Language = VBScript>
Const Folder1 = "C:\Stores"
Const ExtSpec1 = "*.pdf"
strFileName1 = Dir(Folder1 & ExtSpec1)
Do While Len(strFileName1)
strLength = Len(strFileName1) ' Get report name length
strDeleteRPT = strLength - 4
cboStores.AddItem Left(strFileName1, strDeleteRPT)
strFileName1 = Dir
Loop
</SCRIPT>
$subst('Email.Unsub').
*******
This message and any attachment are confidential and may be privileged
or otherwise protected from disclosure. If you are not the intended
recipient, please telephone or email the sender and delete this message
and any attachment from your system. If you are not the intended
recipient you must not copy this message or attachment or disclose the
contents to any other person.
For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.
$subst('Email.Unsub').
$subst('Email.Unsub').
Message #5 by "Drew, Ron" <RDrew@B...> on Mon, 4 Mar 2002 13:22:21 -0500
|
|
Maybe FSO can help you.....
Function GetDirectoryList(FilenameDefault)
Dim objFSO,objFolder,objFile
Dim str
Set objFSO =3D Server.CreateObject("Scripting.FileSystemObject")
Set objFolder =3D objFSO.GetFolder(FILES_PATH)
str =3D ""
For Each objFile in objFolder.Files
if UCase(Right(objFile.Name,3)) =3D "pdf" then
str =3D str & "<option value=3D""" & objFile.Name & """"
if FilenameDefault=3DobjFile.Name then str =3D str & "
selected "
str =3D str & ">" & objFile.Name & "</option>"
End If
Next
Set objFSO =3D nothing
if str =3D "" then
GetDirectoryList =3D "<option>None</option>"
Else
GetDirectoryList =3D str
End If
End Function
-----Original Message-----
From: Colin.Montgomery@C...
[mailto:Colin.Montgomery@C...]
Sent: Monday, March 04, 2002 9:34 AM
To: ASP Databases
Subject: [asp_databases] RE: Filling a combo box
i'm not sure about how to return an array/recordset of all the files in
a particular directory on the server - hopefully someone else can help u
out with that - but I have a couple of pointers 4 u:
Consider storing your PDFs in a non-published directory. Then create a
virtual directory using IIS to point to this folder. This just allows
you more freedom to move the documents onto a storage server. This
would have the knockon effect that staff who upload the PDF files can
map a drive on their local machine and simply drag the files there - no
need to have access to the Web server.
Also, you can't think of a combo box as being an object in ASP. What
you do is use your ASP code to write out the necessary HTML for a combo
box, using your loop to add the necessary number of <OPTION VALUE tags
(1 for each PDF that is). E.g. <OPTION VALUE=3D"<%=3Drs(FileName)%>">
HTH,
Col
-----Original Message-----
From: Michael [mailto:michael.pickens@f...]
Sent: 04 March 2002 13:50
To: ASP Databases
Subject: [asp_databases] Filling a combo box
I have a combo box that I want to fill up with the name of pdf files
that
will be stored in the "inetpub/wwwroot" folder. This way the user can
choose which file they want to see and then I can use the <a href> to
bring up the file for them. I have done this before in VB but never in
ASP. Below is what I tried but as you can guess it didn't work. The
name
of my combo box is cboStores. Below is the code I tried which is what I
use in VB. Any suggestions would be greatly appreciated.
<SCRIPT Language =3D VBScript>
Const Folder1 =3D "C:\Stores"
Const ExtSpec1 =3D "*.pdf"
strFileName1 =3D Dir(Folder1 & ExtSpec1)
Do While Len(strFileName1)
strLength =3D Len(strFileName1) ' Get report name length
strDeleteRPT =3D strLength - 4
cboStores.AddItem Left(strFileName1, strDeleteRPT)
strFileName1 =3D Dir
Loop
</SCRIPT>
$subst('Email.Unsub').
*******
This message and any attachment are confidential and may be privileged
or otherwise protected from disclosure. If you are not the intended
recipient, please telephone or email the sender and delete this message
and any attachment from your system. If you are not the intended
recipient you must not copy this message or attachment or disclose the
contents to any other person.
For further information about Clifford Chance please see our website at
http://www.cliffordchance.com or refer to any Clifford Chance office.
$subst('Email.Unsub').
Message #6 by Colin.Montgomery@C... on Mon, 4 Mar 2002 15:35:31 -0000
|
|
Michael,
Have a look at:
http://www.4guysfromrolla.com/ASPScripts/PrintFAQ.asp?FAQID=90
The virtual directory thing wasn't for security purposes. It would still be
a published, read-only directory -users will be able get the file path
either way. It would make the process of uploading the PDFs to a server
easier, and take the storage strain away from the web server itself. It's
only really applicable if you're going to have loads of PDFs (i.e. GB's
worth) - otherwise just put them in a folder within your site, such as:
c:\inetpub\wwwroot\mySite\PDFdocs\ which would map to:
http://localhost/mySite/PDFdocs/ on your local machine.
You're going to need to use some JavaScript to get the PDF to open from the
combo box - <a href...> isn't going to be applicable.
HTH,
Col
-----Original Message-----
From: Michael W Pickens [mailto:HO0MWP@F...]
Sent: 04 March 2002 14:59
To: ASP Databases
Subject: [asp_databases] RE: Filling a combo box
Colin thanks for replying to my post. I appreciate you taking time out of
your busy schedule to tring and help. If anyone who is reading these knows
how to fill a combo box using the file names of pdfs on the directory of
the server I would much appreciate knowing the answer.
Colin, I have filled a combo box before using a recordset from a database.
So I am a little familiar with that. However, I have no idea on how to
find the names of the files on the web directory or on the C drive to
populate this combo box. I have never done this before and the books just
cover filling in a combo box using a recordset.
I am using PWS as this is just an intranet site. However, using the <A
ref> and the putting the files in the web directory it does not look like
it is giving the user the address of where the file is stored so I think it
is relatively safe right? Am I missing something here? I don't want the
users to have complete access to these files but to be able to view them.
M!
*******
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.
For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.
Message #7 by Colin.Montgomery@C... on Mon, 4 Mar 2002 14:34:25 -0000
|
|
i'm not sure about how to return an array/recordset of all the files in a
particular directory on the server - hopefully someone else can help u out
with that - but I have a couple of pointers 4 u:
Consider storing your PDFs in a non-published directory. Then create a
virtual directory using IIS to point to this folder. This just allows you
more freedom to move the documents onto a storage server. This would have
the knockon effect that staff who upload the PDF files can map a drive on
their local machine and simply drag the files there - no need to have access
to the Web server.
Also, you can't think of a combo box as being an object in ASP. What you do
is use your ASP code to write out the necessary HTML for a combo box, using
your loop to add the necessary number of <OPTION VALUE tags (1 for each PDF
that is). E.g.
<OPTION VALUE="<%=rs(FileName)%>">
HTH,
Col
-----Original Message-----
From: Michael [mailto:michael.pickens@f...]
Sent: 04 March 2002 13:50
To: ASP Databases
Subject: [asp_databases] Filling a combo box
I have a combo box that I want to fill up with the name of pdf files that
will be stored in the "inetpub/wwwroot" folder. This way the user can
choose which file they want to see and then I can use the <a href> to
bring up the file for them. I have done this before in VB but never in
ASP. Below is what I tried but as you can guess it didn't work. The name
of my combo box is cboStores. Below is the code I tried which is what I
use in VB. Any suggestions would be greatly appreciated.
<SCRIPT Language = VBScript>
Const Folder1 = "C:\Stores"
Const ExtSpec1 = "*.pdf"
strFileName1 = Dir(Folder1 & ExtSpec1)
Do While Len(strFileName1)
strLength = Len(strFileName1) ' Get report name length
strDeleteRPT = strLength - 4
cboStores.AddItem Left(strFileName1, strDeleteRPT)
strFileName1 = Dir
Loop
</SCRIPT>
$subst('Email.Unsub').
*******
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.
For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.
Message #8 by "Michael" <michael.pickens@f...> on Mon, 4 Mar 2002 13:49:48
|
|
I have a combo box that I want to fill up with the name of pdf files that
will be stored in the "inetpub/wwwroot" folder. This way the user can
choose which file they want to see and then I can use the <a href> to
bring up the file for them. I have done this before in VB but never in
ASP. Below is what I tried but as you can guess it didn't work. The name
of my combo box is cboStores. Below is the code I tried which is what I
use in VB. Any suggestions would be greatly appreciated.
<SCRIPT Language = VBScript>
Const Folder1 = "C:\Stores"
Const ExtSpec1 = "*.pdf"
strFileName1 = Dir(Folder1 & ExtSpec1)
Do While Len(strFileName1)
strLength = Len(strFileName1) ' Get report name length
strDeleteRPT = strLength - 4
cboStores.AddItem Left(strFileName1, strDeleteRPT)
strFileName1 = Dir
Loop
</SCRIPT>
|
|
 |