CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Cell Color Based on Value

Print topic Send  topic

Author Message
Henryk

Posts: 63
Posted: 06/12/2008, 12:29 PM

I apologize for this in advance, because I am fairly certain this is in the forums somewhere, but I have not had success searching for it (likely because of some brain block on my part).

Anyway, I have a grid with columns whose values are either passed or failed. I want the cell color to change from the default style to something like red if the value in the cell is failed. I really don't know where to start on this. Any advice is welcome. Thank You!
View profile  Send private message
TheunisP

Posts: 342
Posted: 06/12/2008, 1:14 PM

ok to change the cell you need it's background - I'll use BGCOLOR but some wise ass will correct my and say that you need to use CSS, at which point I'll do an inline CSS - and yet another person will tell me that is incorrect

but back to the problem

what you do is chuck another label into the row - for our purpose the BGCOLOR way it must be inside the TD tag - link that to the DB value field of which you want to test

now we can go 2 ways - we go the lazy - less type way

encapsulate the label so you have something like this

<td bgcolor="{Label1}">

click on the label (select it) go the properties and click on the tab - and add a before show - add code - click click and click

ok now in the event you do this

if eventcaller.value = "wakkawakka" then
eventcaller.value="#ff0000"
else
eventcaller.value="#0000ff"
end if

more values? use a case select statement

disclaimer: my hex values were pulled from nowhere I'm not sure what colors they are - but they are gonna be bright

View profile  Send private message
wkempees


Posts: 1679
Posted: 06/13/2008, 4:16 AM

Read (CCS 3+, 4+) Helpfiles: Working with Attributes.
T's method is fine but Attributes are the way to do this nicely.

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
Henryk

Posts: 63
Posted: 06/13/2008, 4:30 AM

I cheated. I formatted the output to include html and then changed the label to output html. That way was so darn easy, I built a view with the formatting in sql and then pulled the grid from the view.
View profile  Send private message
wkempees


Posts: 1679
Posted: 06/13/2008, 4:39 AM

That is how I did it before
- knowing the label approach,
- the attribute approach
- knowing, owning CCS.
Good job.
I do it for creating links, dynamic menues and the lot.
Is called SQL driven Application Design, at least as of today it is.

Walter
O:)


_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.