"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