Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data in db table cell not displayed in asp table cell -- a CSS issue?

Status
Not open for further replies.

PSchubert

Technical User
Jun 6, 2006
57
AU
Hi Tech!

Thanks in advance for your help. Tek-Tips has always been extremely helpful when I'm expreriencing stumpage.

I posted this in the asp forum, where it was suggested that it might be a CSS formatting issue. Is there something with my CSS thaat could be causing the grief?

I have an asp page that connects to a database. Everything works great except for this one table cell on the page.

In the database is a table, tblTravelHistory:

tblTravelHistory_hsj2pd.jpg


(there are other records in the table, but that's not relevant.)

Here is the output to the table on the asp page:

TravelHistory_tlud9t.jpg


As you can see, the Notes cell is empty, where the database table shows "initial entry" in the field mfldNotes. This is the problem.

Here is the relevant code for the page:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]

<html>

   <head>

      <style type="text/css">

	 table.better {
            border-collapse: collapse;
            padding: 2px;
            }

	 table.better, th.better {
            border-style: solid;
            border-width: 1px;
            border-color: #002B53;
            }

	 tr.better:hover {background-color: #ccddff;}

	 th.better {
            background-color: #2B5BA2;
            font-family: arial;
            font-size: small;
            color: white;
            padding: 4px;
            }

	 td.better {
            border-style: solid;
            border-width: 1px;
            border-color: #002B53;
            font-family: arial;
            font-size: small;
            font-weight: bold;
	    text-align: left;
            padding: 4px;
            }

	 td.better0a {
            border-style: solid;
            border-width: 1px;
            border-color: #002B53;
            font-family: arial;
            font-size: small;
            font-weight: bold;
	    text-align: center;
	    color: #009900;
            padding: 4px;
            }

	 td.better0b {
            border-style: solid;
            border-width: 1px;
            border-color: #002B53;
            font-family: arial;
            font-size: small;
            font-weight: bold;
	    text-align: center;
	    color: #FF0000;
            padding: 4px;
            }

      </style>

<%

   Dim conn			
   Dim rs
   Dim strSQL
   Dim strConnection
   Dim idxItems
   Dim i
   Dim InOut
   Dim temp

   Set conn = Server.CreateObject("ADODB.Connection")
   Set rs = Server.CreateObject("ADODB.Recordset")

   idxItems = rs("idxItems") 'this line is out of place in this post; the variable holds a value from a previously opened recordset that filters the records returned by the below SQL

   InOut = array("IN", "OUT")

   Response.Write("<title>" & Session("name") & " Collection</title></head><body style='margin-left: 20px;'>")

   conn.Open strConnection

   strSQL = "SELECT ynfldInOut, dfldDate, mfldNotes, tfldReference FROM tblTravelHistory " & "WHERE nfldidxItems=" & idxItems & ";"

   Set rs = conn.Execute (strSQL)

   Response.Write("<table class='better'><caption style='font-family: arial; font-size: small; font-weight: bold; text-decoration: underline;'>Travel History</caption>" & _
      "<tr><th class='better'>IN / OUT</th><th class='better'>Date</th><th class='better'>Notes</th><th class='better'>Reference</th></tr>")

   rs.MoveFirst

   Do While Not rs.EOF
      Response.Write ("<tr class='better'>")

      For i = 0 to rs.Fields.Count - 1

      temp = rs.Fields(i)

      If i = 0 Then
         If temp + 1 = 0 Then 
            temp = "0a'>" & InOut(temp + 1)
         Else
            If temp + 1 = 1 Then 
               temp = "0b'>" & InOut(temp + 1)
            End If
         End If
      Else
         temp = "'>" & rs.Fields(i)
      End If

      Response.Write("<td class='better" & temp & "</td>")
      Next

      Response.write("</tr>")

      rs.MoveNext
   Loop

   Response.Write("</table>")
	
   rs.Close

   Response.Write("</body></html>")

   set rs = Nothing
   conn.Close
   set conn = Nothing
   Response.End
%>

(there's more to the page, but as it all works great I haven't included it.)

I can't figure it out, especially as I have five other tables on the page that display perfectly with basically the same code, EXCEPT that four of them don't use the InOut array. Why would this one cowardly field and/or table cell stubbornly refuse to show itself?

I humbly turn the problem over to you Tek-Tippers, who have proven yourselves in the past to be much smarter than I.
 
Your CSS has nothing obvious that would be hiding the notes.

As ggriffit suggests, post the finalized hTML instead of the ASP code for a better look at what is actually being sent to the browser and how the CSS is being applied to it.

If the Notes don't appear in the final HTML then it would be clear the issue is from either ASP code or the query and I would then verify that your query is actually returning rows with the notes field populated. And if so, that your ASP code is actually printing them out in the table cell.

Original thread in the ASP forum:
thread333-1783073





----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top