"Mike Brind" <pa*******@hotm ail.com> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
PW wrote: Is it possible to make a select list item red based on a condition ?
TIA,
PW
Are you asking whether one can apply different styles to items in a
select list, or how to code conditional statements with server-side
code?
If the first, try googling optgroup and css, and see if this answers
your question. If it doesn't, you would be better off asking in a css
or stylesheet group.
If it's the second (although I suspect not) show the code you've tried,
and explain where it fails.
--
Mike Brind
Hi Mike,
Thanks for your response. I have since googled and found an answer.
I've created the css as suggested ...
<head>
<STYLE type="text/css">
OPTION.red{back ground-color:white; color:red}
OPTION.black{ba ckground-color:white; color:black}
</STYLE>
</head>
I then created a string based on the condition ...
if len(rs1("NOTES" )) > 0 then
myOptionText = " class=red "
else
myOptionText = " class=black "
end if
And then concatenated the string into the <option> statement based on the
condition ...
if mySearchString <> "" then
if rs1("ESCI") = mySearchString then
response.write "<option selected " & myOptionText & ">"
else
response.write "<option " & myOptionText & ">"
end if
elseif rs1("ESCI") = left(myQueryStr ing,6) then
response.write "<option selected " & myOptionText & ">"
else
response.write "<option " & myOptionText & ">"
end if
Thanks,
PW