Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Selecting a value from a listbox to use in an include file


Message #1 by "Warren Nash" <wnash@c...> on Thu, 24 Aug 2000 11:39:3
I am trying to populate a listbox from a database and then allow the user 

to select a title from the listbox which would then add the include 

filename to my script. Populating the listbox is fine but I am having a 

hard time getting the include filename. Any suggestions.

Thanks in advance 

Warren

Message #2 by "Asmadi Ahmad" <chloro@e...> on Thu, 24 Aug 2000 19:18:36 +0800
if you want to do something like this:



If rs("Status") = true then

<!--#INCLUDE FILE="top.asp"-->

else

<!--#INCLUDE FILE="bot.asp"-->

end if



then forget it. I think ASP will load all include statements first before

parsing thru the code, so both top.asp and bot.asp will be loaded....



asmadi

www.effitech.com





----- Original Message -----

From: Warren Nash 

To: ASP Databases <asp_databases@p...>

Sent: Thursday, 24 August, 2000 11:00 AM

Subject: [asp_databases] Selecting a value from a listbox to use in an

include file





> I am trying to populate a listbox from a database and then allow the user

> to select a title from the listbox which would then add the include

> filename to my script. Populating the listbox is fine but I am having a

> hard time getting the include filename. Any suggestions.

> Thanks in advance

> Warren

>

Message #3 by smartin@c... on Thu, 24 Aug 2000 10:10:31 -0400
Actually, Asmadi, the way you suggest is the proper way to do it for just

the reason you state.  All INCLUDE directives are processed *before* any

script is executed, so you can't do something like:



<%

strPage = Request.Form("Page")

%>

<!-- #INCLUDE FILE="<%= strPAge %>" -->



Why?  Because the value of strPage has not been determined before the

INLCUDE directive is processed.



You are also correct that both/all of the inlcuded files will be included,

but at least you get selective execution.  Of course, the server.execute

command in ASP 3.0 makes this discussion moot.



Stephen Martin

Chief Web Architect

Public Access Technologies

Fairfax County, Virginia

http://www.co.fairfax.va.us





> -----Original Message-----

> From: Asmadi Ahmad 

> Sent: Thursday, August 24, 2000 7:19 AM

> To: ASP Databases

> Subject: [asp_databases] Re: Selecting a value from a listbox 

> to use in

> an include file

> 

> 

> if you want to do something like this:

> 

> If rs("Status") = true then

> <!--#INCLUDE FILE="top.asp"-->

> else

> <!--#INCLUDE FILE="bot.asp"-->

> end if

> 

> then forget it. I think ASP will load all include statements 

> first before

> parsing thru the code, so both top.asp and bot.asp will be loaded....

> 

> asmadi

> www.effitech.com

> 

> 

> ----- Original Message -----

> From: Warren Nash 

> To: ASP Databases <asp_databases@p...>

> Sent: Thursday, 24 August, 2000 11:00 AM

> Subject: [asp_databases] Selecting a value from a listbox to use in an

> include file

> 

> 

> > I am trying to populate a listbox from a database and then 

> allow the user

> > to select a title from the listbox which would then add the include

> > filename to my script. Populating the listbox is fine but I 

> am having a

> > hard time getting the include filename. Any suggestions.

> > Thanks in advance

> > Warren

> >

> 


  Return to Index