conditional table cell format

Results 1 to 3 of 3

Thread: conditional table cell format

  1. #1
    Join Date
    Dec 1969

    Default conditional table cell format

    I hope some kind heart can help me with this.<BR><BR>How can i display a table from an access database and format the table cells based on the value of the data contained in the cell.<BR><BR>For example, if the value of the of data in a cell is &#060;5 i want the cell colored red, etc<BR><BR><BR>thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: conditional table cell format

    Humm i this what you want to do is write a subroutine which gets your values from the database. then call this in the table.<BR><BR>sub colour<BR> If objrec("cell") = &#060;5 then <BR> response.write "bgcolour=#555555"<BR> end if <BR><BR> If objrec("cell") = 7 then <BR> response.write "bgcolour=#888888"<BR> end if <BR>end sub<BR><BR><BR>then when writing the table to the page just put <BR><BR>&#060;table width=100 height=800 &#060;%call colour%&#062; &#062;<BR><BR>think this is what you want to do?? <BR><BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default I think...

    ...he may want to do it on a individual cell basis. Oh well, he&#039;s got two answers now, he can take his pick:<BR><BR>Function bgColorVal(Number)<BR> If Number &#060; 5 then<BR> bgColorVal = "#666666" &#039;or whatever red is<BR> Else<BR> bgColorVal = "#000000"<BR> End if<BR>End function<BR><BR>Do while blah blah<BR><BR>Response.Write "&#060;td bgcolor=" & bgColorVal(rs("Number")) & "&#062;" & rs("Number") & "&#060;/td&#062;"<BR><BR>rs.Movenext blah blah<BR><BR>Matt<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts