navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Contents of Field Determines Results Table Color

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Contents of Field Determines Results Table Color
Page: [1]
 
qqqing

 

Posts: 5
Joined: 3/5/2002
From: VA USA
Status: offline

 
Contents of Field Determines Results Table Color - 3/5/2002 6:54:34   

I have an interactive database using Frontpage 2000 asp. I would like to know how to make the table change color depending on the contents of the Status field. One record comes back and the Status can be, Unassigned,(gray), Assigned, (red), In Progress,(yellow), or Completed, (green).
I saw the answer about alternating the row color, but I can't figure out the vbscript to change the table color based on the contents of a field.
I appreciate all your help.
Thank you.
Chriswilks

 

Posts: 30
From: Milton Keynes United Kingdom
Status: offline

 
RE: Contents of Field Determines Results Table Color - 3/5/2002 10:02:20   
Cobbled together from other posts I've read here this works for me. Apologies for not changing the colors.


<%
Status= FP_FieldVal(fp_rs,"Status")
' Green
If Status = "Unassigned" then
response.write "bgcolor='#66FF66'"
' Orange
Elseif Status = "Assigned" then
response.write "bgcolor='#FF9933'"
' Yellow
Elseif Status = "In Progress" then
response.write "bgcolor='#FFFF99'"
' Red
Elseif Status = "Completed" then
response.write "bgcolor='#FF5959'"
end if
%>

 

(in reply to qqqing)
qqqing

 

Posts: 5
Joined: 3/5/2002
From: VA USA
Status: offline

 
RE: Contents of Field Determines Results Table Color - 3/5/2002 10:43:33   
Thank you for your response.
I can see that the code has some effect, but I don't think I have placed it correctly. In the results page, above the table there is code like "bgcolor='FFFF99'" showing as text but the table does not change color.
Thanks.


(in reply to qqqing)
Chriswilks

 

Posts: 30
From: Milton Keynes United Kingdom
Status: offline

 
RE: Contents of Field Determines Results Table Color - 3/5/2002 10:51:45   
I t would be best to put you page on the Spooky diet

http://www.outfront.net/spooky/adv_drw_diet.htm

It's much easier to see what you're doing then.

You should have a bit of red code like <%=FP_FieldVal(fp_rs,"Status")%>

Just replace that with with the code for changing cell color




 

(in reply to qqqing)
qqqing

 

Posts: 5
Joined: 3/5/2002
From: VA USA
Status: offline

 
RE: Contents of Field Determines Results Table Color - 3/5/2002 11:55:32   
Thank you for all the information. I did not realize that asp code could be so lean. I followed your directions successfully, but now the code is writing "bgcolor='#FF9933' in the Status cell rather than changing the color. It needs a few tweaks.
First, the color needs to change and secondly, I would really like it to change the color of the table and not just the cell. If it changed the color of the row, that would be of help, too.

Thank you for your help. Before your response I was getting nothing but errors.


(in reply to qqqing)
Chriswilks

 

Posts: 30
From: Milton Keynes United Kingdom
Status: offline

 
RE: Contents of Field Determines Results Table Color - 3/5/2002 12:12:45   
No problem.

You can still change the color of the table. That code will override it for specific cells. There's details in the faq section on how to alternate row color for a nice effect

http://www.outfront.net/spooky/advanced.htm#alt

You can combine all these together for a table that's 1 color with row colors that alternate and cells that color code for specific info

Sorry didn't spot your problem. Missing the " off the end of a line

"bgcolor='#FF9933'"

Edited by - chriswilks on 03/05/2002 14:15:41

(in reply to qqqing)
qqqing

 

Posts: 5
Joined: 3/5/2002
From: VA USA
Status: offline

 
RE: Contents of Field Determines Results Table Color - 3/5/2002 17:04:13   
Wanted you to know that your code worked with a couple of changes.
I used
bgcolor="gray" instead of
response.write "bgcolor='#66FF66'"

I placed this at the top of the table
<%
Status= FP_FieldVal(fp_rs,"Status")
' Gray
If Status = "Unassigned" then
bgcolor="gray"
' Gray
Elseif Status = "Assigned" then
bgcolor="yellow"
' Yellow
Elseif Status = "In Progress" then
bgcolor="red"
' Red
Elseif Status = "Completed" then
bgcolor="green"
end if
%>

AND I placed a variable: bgcolor='<%=bgcolor%>'

in the td tag for the status field. It worked for that cell:
<td bgcolor='<%=bgcolor%>' width="73"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"STATUS")%>


I then placed the variable in the td tag of every row. Now the whole row changes color depending on the contents of the status field.
Thanks for your help. Hope this helps someone else.



(in reply to qqqing)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Contents of Field Determines Results Table Color
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts