Helpful Information
 
 
Category: ASP
altering bgcolor of cell based on content

I would like to change the bgcolor of a table data cell based on it's content.
Nothing fancy, just a color of red if the <td> cell contains any values.
I haven't done much with ASP but did quite a bit of work with Coldfusion some time ago.

Can you give me an idea of where to begin?

Thank You :)
Kevin

This is just a simple example. There are 100's of different ways to make it work. This is just a simple way. Think it speakse for itself? If not, contact met by email, or visit my website: http://www.paardekam.nl. Good luck!

IF someVar="someValue" THEN
Response.Write "<TD BGCOLOR=""#FFFFFF"">" & vbCrLf
ELSE
Response.Write "<TD BGCOLOR=""#000000"">" & vbCrLf
END IF

I thought it might look like what you've shown me but was uncertain as I haven't worked in Vb or done any work in ASP.

I am actually helping out another party here so if they need something more complicated I would probably pass them along.

Just out of curiosity what does the [ & vbCrlf ] refer to in the statemtent?

I appreciate the time and insight

Thank You
Kevin:thumbsup:

No problem. I'm glad to be of any help. The vbCrLf command stands for

Visual Basic Carriage Return Line Feed

That probably doesn't say much as well... When you're familiar with HTML, it can be considered as a <BR> tag, but then in the source code. It a line break. Just use it in your code and see what it does, by viewing your source-code. Good luck.

I see what your saying on the vb code.
I have some basics in C at the moment.

Will be working a little more in that area in the
near future.

all insights always appreciated

Thank You
Kevin:thumbsup:










privacy (GDPR)