This topic is locked

Coloring the background color of a field according it's value - in

1/16/2007 11:41:12 AM
ASPRunnerPro General questions
orit author

How can I color the background color of a cell according its value (text field): for example if the value in the field is "Yes" - the background color of the cell will be green and if the value in the field is "No" - the background color of the cell will be red, If empty - no special background color?
You instructed me how to do something similar thing direct in the code in previous versions of asprunner but I want to know how to do that in ASPRunner 4.1
Thanks a lot

orit author 1/17/2007

Thanks.

Unfortunately, seems like the custom code doesn't affect my application.
My custom code for the field that suppose to get the appropriate color is:

if InStr(Request.ServerVariables("SCRIPT_NAME"), "_export")<1 then

str = "<table width=100% bgcolor="

if (strValue)="Yes" then

str = str & "green"

elseif (strValue)="No" then

str = str & "red"

elseif (strValue)="NR" then

str = str & "black"

else

str = str & ""

end if

str = str & "><tr><td align='center'>" & strValue & "</td></tr></table>"

strValue = str

end if


Nothing was changed after I added the custom code, just as with the file type image - the application works but without the feature that the custom code suppose to supply.
I see the custom code in the commonfunctions.asp file.

When I look at the "view source" of the page I see the cell as before:

<td>

Yes

</td>


Can you please advise?
Thanks a lot

Sergey Kornilov admin 1/17/2007

Make sure this field is not a Lookup wizard.

Custom code cannot be applied to lookup wizard field.

orit author 1/17/2007

In the Add\Edit page, those fields are radio button. Is that problematic?
Thanks

Sergey Kornilov admin 1/17/2007

Yes, in current version you cannot apply Custom Code to this field.

orit author 1/17/2007

Is there a way to implement it not via GUI, but directly in code? If yes, How?
Thanks

Sergey Kornilov admin 1/17/2007

No.
You need to wait till we add an option to apply custom code to lookup wizard/radio button fields.