asp help please

  • Thread starter Thread starter Paul M
  • Start date Start date
P

Paul M

Hi I cant get this to work.
xstatusfield is a variable as part of a select statement but this code just
stops the page from displaying

any help would be most appreciated
Paul M


<% If xstatusfield = "Charity" Then

Response.Write "<p><span class="bold">Charity
Number<span lang="en-gb">
(if applicable)</span></span><br />
<input name="MC_contactname" value="" size="49"
/></p>"
Else
End If
%>
 
Either:

<% If xstatusfield = "Charity" Then %>

<p><span class="bold">Charity Number (if applicable)</span><br />
<input name="MC_contactname" value="" size="49" /></p>"

<% Else

End If
%>

Or

<% If xstatusfield = "Charity" Then

Response.Write "<p><span class=""bold"">Charity Number (if
applicable)</span><br /><input name=""MC_contactname"" value=""""
size=""49"" /></p>"
Else
End If
%>

Note in the second example that the response.write string should all be on
one line, and the quotes are doubled up. In the first example the string
will appear in design view - but not in the page when browsing unless the
if... condition is met.
 
Or without the response write (since there is no code in it)
<% If xstatusfield = "Charity" Then %>
<p>
<span class="bold">Charity Number<span lang="en-gb"> (if applicable)</span></span><br />
<input name="MC_contactname" value="" size="49" />
</p>
<% Else ' do nothing %>
<% End If %>


--




| Either:
|
| <% If xstatusfield = "Charity" Then %>
|
| <p><span class="bold">Charity Number (if applicable)</span><br />
| <input name="MC_contactname" value="" size="49" /></p>"
|
| <% Else
|
| End If
| %>
|
| Or
|
| <% If xstatusfield = "Charity" Then
|
| Response.Write "<p><span class=""bold"">Charity Number (if
| applicable)</span><br /><input name=""MC_contactname"" value=""""
| size=""49"" /></p>"
| Else
| End If
| %>
|
| Note in the second example that the response.write string should all be on
| one line, and the quotes are doubled up. In the first example the string
| will appear in design view - but not in the page when browsing unless the
| if... condition is met.
| --
| Ron Symonds - Microsoft MVP (Expression)
| Reply only to group - emails will be deleted unread.
| http://www.rxs-enterprises.org/fp
|
| | > Hi I cant get this to work.
| > xstatusfield is a variable as part of a select statement but this code
| > just stops the page from displaying
| >
| > any help would be most appreciated
| > Paul M
| >
| >
| > <% If xstatusfield = "Charity" Then
| >
| > Response.Write "<p><span class="bold">Charity
| > Number<span lang="en-gb">
| > (if applicable)</span></span><br />
| > <input name="MC_contactname" value=""
| > size="49" /></p>"
| > Else
| > End If
| > %>
| >
| >
|
 
Thanks Guys
Didn't realize I had to close the asp code to insert html
lesson learnt
Paul M
 
You don't... the problem you were having is that you were closing your
response string early when you hit the quotes in the class="bold". What you
can do is to replace the double-quotes on the attributes with single quotes.
Also what I do for troubleshooting is to dump the variable in an html
comment

<%
IF xstatusfield = "Charity" THEN
Response.Write("<p><span class='bold'>Charity Number<span
lang='en-gb'>(if applicable)</span></span><br />")
Response.Write("<input name='MC_contactname' value='' size='49'/></p>")
ELSE
Response.Write("<!--" & xstatusfield & "-->")
END IF
%>
 
Back
Top