471,074 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,074 software developers and data experts.

choosing an include file

I have a page which, according to the boss's instructions, needs to show one
of two things, based on which radio button was chosen on the previous page.
Because these 'things' are actually some chunks of code which contain sql
queries, loops, etc., I think it might be best to put each of them into an
include.

Will this work:

<%If strReports = "Detailed" then%>
<!-- #INCLUDE FILE="builddetailedreport.asp" -->
<%Else%>
<!-- #INCLUDE FILE="buildsummary.asp" -->
<%End if%>
Or would it be better to do a response.write?
<%If strReports = "Detailed" then
Response.write "<!-- #INCLUDE FILE='builddetailedreport.asp'--> "
Else
Response.write "<!-- #INCLUDE FILE='buildsummary.asp' --> "
End if%>
Jul 19 '05 #1
3 3493

"middletree" <mi********@htomail.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
I have a page which, according to the boss's instructions, needs to show one of two things, based on which radio button was chosen on the previous page. Because these 'things' are actually some chunks of code which contain sql
queries, loops, etc., I think it might be best to put each of them into an
include.

Will this work:

<%If strReports = "Detailed" then%>
<!-- #INCLUDE FILE="builddetailedreport.asp" -->
<%Else%>
<!-- #INCLUDE FILE="buildsummary.asp" -->
<%End if%>
This will work. Both files will be included, but only the code in the one
that is in the true condition will be executed.
Example:
include1.asp:
<% Response.Write "I'm included." %>
include2.asp:
<% Response.Write "I'm included, but not executed." %>

page.asp:
<% If 1 = 1 Then %>
<!-- #include file="include1.asp" -->
<% Else %>
<!-- #include file="include2.asp" -->
<% End If %>

That would be the same as:
<% If 1 = 1 Then %>
<% Response.Write "I'm included." %>
<% Else %>
<% Response.Write "I'm inlcluded, but not executed." %>
<% End If %>
Or would it be better to do a response.write?
<%If strReports = "Detailed" then
Response.write "<!-- #INCLUDE FILE='builddetailedreport.asp'--> "
Else
Response.write "<!-- #INCLUDE FILE='buildsummary.asp' --> "
End if%>


This will not work. All that would do is create a comment in your html
output. Include directives aren't part of the response, and they are
processed before any asp is.

Ray at work
Jul 19 '05 #2
"middletree" <mi********@htomail.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
I have a page which, according to the boss's instructions, needs to show one of two things, based on which radio button was chosen on the previous page. Because these 'things' are actually some chunks of code which contain sql queries, loops, etc., I think it might be best to put each of them into an include.

Will this work:

<%If strReports = "Detailed" then%>
<!-- #INCLUDE FILE="builddetailedreport.asp" -->
<%Else%>
<!-- #INCLUDE FILE="buildsummary.asp" -->
<%End if%>
Or would it be better to do a response.write?
<%If strReports = "Detailed" then
Response.write "<!-- #INCLUDE FILE='builddetailedreport.asp'--> "
Else
Response.write "<!-- #INCLUDE FILE='buildsummary.asp' --> "
End if%>


I would go with the first one since the second one simply prints out the
include directive. ;-p

-Chris Hohmann

Jul 19 '05 #3
www.aspfaq.com/2042

"middletree" <mi********@htomail.com> wrote in message
news:#x*************@TK2MSFTNGP11.phx.gbl...
I have a page which, according to the boss's instructions, needs to show one of two things, based on which radio button was chosen on the previous page. Because these 'things' are actually some chunks of code which contain sql
queries, loops, etc., I think it might be best to put each of them into an
include.

Will this work:

<%If strReports = "Detailed" then%>
<!-- #INCLUDE FILE="builddetailedreport.asp" -->
<%Else%>
<!-- #INCLUDE FILE="buildsummary.asp" -->
<%End if%>
Or would it be better to do a response.write?
<%If strReports = "Detailed" then
Response.write "<!-- #INCLUDE FILE='builddetailedreport.asp'--> "
Else
Response.write "<!-- #INCLUDE FILE='buildsummary.asp' --> "
End if%>

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Jean de Largentaye | last post: by
25 posts views Thread by David Sanders | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.