This topic is locked
[SOLVED]

 Text color formating based on the value

2/15/2018 11:07:30 AM
ASPRunner.NET General questions
S
stefansuba author

Hi ,

I need to have different text colors in a column based on the value on the list page.

The column name is Warhouse_id and the values are 14, 15, 51 ,72

Each value should have a different color. I tried to used "view as" -custom option and C# without success.

Can someone help me please ?
Thx

MK Frank R 2/15/2018

Check the help. It's documented there.
You won't be finding that just by configuring from the tool interface. You need to write event code, but, this topic is documented in the help.

S
stefansuba author 2/15/2018



Check the help. It's documented there.
You won't be finding that just by configuring from the tool interface. You need to write event code, but, this topic is documented in the help.


I used this in the custom filed under "view as" and it works:
XVar color;

if(value ==51)

color = "green";

else

if(value ==71)

color = "Orange";

else

if(value ==20)

color = "blue";

else

if(value ==14)

color = "violet";

else

if(value ==50)

color = "red";

else

color = "black";

value = MVCFunctions.Concat("<font color='", color, "'>", value, "</font>");

admin 2/15/2018

Just in case here is a link to more examples:

https://xlinesoft.com/asprunnernet/docs/conditional_formatting.htm