×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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:



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

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



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"
"http://www.w3.org/TR/html4/loose.dtd">

<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.

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

can you post the HTML source rather than the ASP code ?

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
http://www.greggriffiths.org/livelink/

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

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: Data in DB table cell not displaying in asp page table cell





----------------------------------
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close