View Full Version : syntax error
vkdixit
01-06-2009, 09:10 AM
<%
shtml="<tr><td><font size=""2"" face=""Verdana, Arial, Helvetica, sans-serif""><strong>Receive Salmagundi : </strong></font></td><td><input type=""checkbox"" name=""chkSalmagundi"" value=""1"" "& if rsPaging("userReceiveSalmagundi")=1 then Response.Write checked &" /></td></tr><tr>"
%>
i want that my page load this code will be run and i have got the output if
rsPaging("userReceiveSalmagundi") has value in database 1, then cheched. this is an asp page
error on the syntax of if()... and if condition is using as one line displayed like above code.... plz free me with this syntax error
plz help
Fou-Lu
01-06-2009, 01:17 PM
End if?
Sorry, its been years since I've used standard ASP. But methinks you'll need you're End if in there.
angst
01-06-2009, 03:08 PM
no, actually you don't need end if,
it can work like:
if SomeCondition = true Then DoSomething
the problem is that an IF station can not be wrapped in " & IF & "
instead just break the line:
shtml="<tr><td><font size=""2"" face=""Verdana, Arial, Helvetica, sans-serif""><strong>Receive Salmagundi : </strong></font></td><td><input type=""checkbox"" name=""chkSalmagundi"" value=""1"""
if rsPaging("userReceiveSalmagundi")=1 then Response.Write checked
response.write " /></td></tr><tr>"
vkdixit
01-07-2009, 07:45 AM
no, actually you don't need end if,
it can work like:
if SomeCondition = true Then DoSomething
the problem is that an IF station can not be wrapped in " & IF & "
instead just break the line:
shtml="<tr><td><font size=""2"" face=""Verdana, Arial, Helvetica, sans-serif""><strong>Receive Salmagundi : </strong></font></td><td><input type=""checkbox"" name=""chkSalmagundi"" value=""1"""
if rsPaging("userReceiveSalmagundi")=1 then Response.Write checked
response.write " /></td></tr><tr>"
Thanx for ur reply but the syntax error occur on if condition. i have done what ever u have sent. but this code also not supportive....
If u have any idea plz.........
vkdixit
01-07-2009, 07:46 AM
End if?
Sorry, its been years since I've used standard ASP. But methinks you'll need you're End if in there.
Thankx for reply...actually its one line if statement so no need to give here END IF.
If u have any other idea plzzzzz..
brazenskies
01-07-2009, 08:49 AM
try creating a variable and passing that into the string...
<%
dim checkedValue
if rsPaging("userReceiveSalmagundi")=1 then
checkedValue = "checked"
else
checkedValue = ""
end if
shtml="<tr><td><font size=""2"" face=""Verdana, Arial, Helvetica, sans-serif""><strong>Receive Salmagundi : </strong></font></td><td><input type=""checkbox"" name=""chkSalmagundi"" value=""1"" "& checkedValue &" /></td></tr><tr>"
%>
vkdixit
01-07-2009, 09:22 AM
try creating a variable and passing that into the string...
<%
dim checkedValue
if rsPaging("userReceiveSalmagundi")=1 then
checkedValue = "checked"
else
checkedValue = ""
end if
shtml="<tr><td><font size=""2"" face=""Verdana, Arial, Helvetica, sans-serif""><strong>Receive Salmagundi : </strong></font></td><td><input type=""checkbox"" name=""chkSalmagundi"" value=""1"" "& checkedValue &" /></td></tr><tr>"
%>
thansx for the reply... but i want to do it in 1 line what ever i have posted like..... i know that error existing as syntax error near "& if ....=1 then response.write checked &"
brazenskies
01-07-2009, 09:38 AM
in that case it's gonna get pretty complicated with all your quote marks and messy!
vkdixit
01-07-2009, 10:54 AM
in that case it's gonna get pretty complicated with all your quote marks and messy!
yes... but when i am using this code inside a loop then it will give give proper result whatever i want so plz make me free with this syntax error...
so plz..........
angst
01-07-2009, 04:44 PM
ah right, just forgot the quotes around Checked*
shtml="<tr><td><font size=""2"" face=""Verdana, Arial, Helvetica, sans-serif""><strong>Receive Salmagundi : </strong></font></td><td><input type=""checkbox"" name=""chkSalmagundi"" value=""1"""
if rsPaging("userReceiveSalmagundi")=1 then Response.Write "checked"
response.write " /></td></tr><tr>"
vkdixit
01-14-2009, 12:02 PM
try creating a variable and passing that into the string...
<%
dim checkedValue
if rsPaging("userReceiveSalmagundi")=1 then
checkedValue = "checked"
else
checkedValue = ""
end if
shtml="<tr><td><font size=""2"" face=""Verdana, Arial, Helvetica, sans-serif""><strong>Receive Salmagundi : </strong></font></td><td><input type=""checkbox"" name=""chkSalmagundi"" value=""1"" "& checkedValue &" /></td></tr><tr>"
%>
Thanks for the right suggession...................
Thanks alot
brazenskies
01-14-2009, 01:01 PM
no probs
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.