If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Highlighting tables from DB?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-22-04, 19:50
ashrak ashrak is offline
Registered User
 
Join Date: Sep 2004
Posts: 4
Highlighting tables from DB?

Hi everyone,

Ive created a web page that queries a db and i have that all working fine. What i dont have though and would like to be able to do is get the page to highlight rows according to one colums value, ie


Colum1 Colum2
Row 1 50 Test <-- would like to the be highlihted lite blue for instance
Row 2 90 Test2 <-- would like this to be highlighted red for instance

Ive attached a file to show what i mean, any help on this would be much appreciated
Attached Images
File Type: jpg help.JPG (88.3 KB, 78 views)
Reply With Quote
  #2 (permalink)  
Old 09-22-04, 19:53
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
that's easy enough, create a style sheet with a class for a standard row and one for a selected row then when you are outputting the data check the values and and if it should be selected set the class of the row to the appropriate style else leave it with the default style...
Reply With Quote
  #3 (permalink)  
Old 09-22-04, 19:56
ashrak ashrak is offline
Registered User
 
Join Date: Sep 2004
Posts: 4
um sorry but i aint that advanced. woudl you care to spell it out a little more?
Reply With Quote
  #4 (permalink)  
Old 09-22-04, 20:12
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
okie, you a simpler version....assuming you are building the table by looping through a recordset or something....
Code:
<table>
  
  <%
  Do while not myRecordset.EOF
    bgcolor = "#FFFFFF"
    if myRecordset("value1")=0 then bgcolor="#CCCCCC"
  %>
    <tr bgcolor="<%=bgcolor%>"><td><%=myRecordset("value1")%></td></tr>
  <%
    myRecordset.MoveNext
  Loop
  %>
</table>
clear as mud??
Reply With Quote
  #5 (permalink)  
Old 09-22-04, 20:26
ashrak ashrak is offline
Registered User
 
Join Date: Sep 2004
Posts: 4
not really, i connect to the DB usign

Code:
<%
fp_sQry="SELECT * FROM AlarmView WHERE (NameAlarm like  'NeaxAlarm%' AND NameEquip LIKE 'TAX%')"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=4 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="SuperviewTest"
fp_iMaxRecords=300
fp_iCommandType=1
fp_iPageSize=15
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="Sent"
fp_sMenuValue="Sent"
fp_sColTypes="&KeyAlarm=3&Received=135&Touched=135&Sent=135&NameAlarm=202&Display=202&Oid=202&KeyEquip=3&KeyDeviceDriverClass=3&NameEquip=202&IpAddress=202&KnownAs=202&TimeZone=202&NameEquipClass=202&Components1=202&Components2=202&Components3=202&Components4=202&Components5=202&"
fp_iDisplayCols=4
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
i have played around and been able to get it to color the whole severity colum one color, but still cannot get it to change based on the rows value. Also was hopefully wanting the color to go across the whole row if possible which currently i am unable to do.


*** Edited to add screenie and also add the code into code box.
Attached Images
File Type: jpg help2.JPG (88.0 KB, 68 views)

Last edited by ashrak; 09-22-04 at 20:30.
Reply With Quote
  #6 (permalink)  
Old 09-23-04, 00:41
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
well you could post the whole page of code and we could look at that... what are you using to write your page??
Reply With Quote
  #7 (permalink)  
Old 09-23-04, 21:11
ashrak ashrak is offline
Registered User
 
Join Date: Sep 2004
Posts: 4
all good ive completed the page the code i used was

Code:
x = CINT(FP_FieldVal(fp_rs,"Severity"))
if x <= 10 then
bgcolor = "#E42217"
elseif x => 11 and x <= 30 then
bgcolor = "orange"
elseif x => 31 and x <= 50 then
bgcolor = "yellow"
elseif x => 51 and x <= 70 then
bgcolor = "#82CAFF"
elseif x => 71 and x <= 90 then
bgcolor = "#41A317"
end if
%>
and then added this to the where the tables were drawn after the query of the database

Code:
 <td BGCOLOR=<%=bgcolor%>>


Thanks for your initial help anyways much appreciated

Last edited by ashrak; 09-23-04 at 21:14. Reason: Adding code into code box
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On