This topic is locked

Changing Text Colour

3/15/2004 6:09:21 AM
ASPRunnerPro General questions
C
christybhoy author

hi,

I am using AspRunner 2.4 to generate a few asp pages.

Everything is working fine.

However, would anyone know, is it possible to change

the colour of some text if it meets a certain criteria?
I would like the text in the colum 'Days left to Close'


If the number is negative i wouls like it to change to RED!
Thanx in advance............Christy

Sergey Kornilov admin 3/15/2004

Christy,
here is how you can do this.
Open ..._list.asp file in any text editor and find portion of code that dsiplays DaysLeft field. That would something like this:

<%

if IsBinaryField(rsData.Fields("DaysLeft")) or Format("DaysLeft")=FORMAT_DATABASE_FILE then

   Response.Write CreateImageControl(rsData, "DaysLeft", "")

else

   Response.Write ProcessLargeText(GetData(rsData.Fields("DaysLeft"), ""))

end if

%>


Here is how it should look like:

<%

if CLng(GetData(rsData.Fields("DaysLeft"), ""))<0

   Response.Write "<font color=red>" & GetData(rsData.Fields("DaysLeft"), "") & "</font>"

else

   Response.Write GetData(rsData.Fields("DaysLeft"), "")

end if

%>


I hope this helps.

C
christybhoy author 3/16/2004

<%

if CLng(GetData(rsData.Fields("DaysLeft"), ""))<0

      Response.Write "<font color=red>" & GetData(rsData.Fields("DaysLeft"), "") & "</font>"

else

      Response.Write GetData(rsData.Fields("DaysLeft"), "")

end if

%>


This works great - i needed to add 'then' after ...""))<0
I have some fields which have null values

so i'll need to use isNull statement to work round this problem

as it will not display any fields that are blank...
Thanx...............again

Christy