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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Table Question

Status
Not open for further replies.

030575

MIS
Feb 20, 2005
4
US
Hello,

I need to show the results in a HTML table. I have an HTML page where a user can select an option e.g all reports asociated with a department. The code then takes this department code and goes through a database and shows the results. I am using ASP for this. The results are shown in an HTML table.

If there are many records associated with a department, the html table with the results does not show at the top of the page but further down. The bigger the result set, the further down it is.


Is there anything I can do to show the results starting at the top of the page whether the result set is big or small.


Thanks

Pallavi
 
Yes there is but you'll have to give us more info that that. A link to the page or the code would be a good start.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I agree with ca8msm. We need to see your code.

As the table is being dynamically generated by the ASP, i'm going to bet that something is being printed outside the table pushing it down. i.e a "&nbsp".

But we need to see code to be of further assistance.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
All,
Thank you for your response.

Here is the code.

Thanks
Pallavi


<code>
<html>
<head>
<title>Update Entry Select</title>
</head>
<body bgcolor="white" text="black">
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Dim tpr
Dim size
Dim priority
Dim title
Dim contact
Dim status
Dim department
Dim c#

'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Project.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT TPRDetails.* FROM Project WHERE Department = 'Phones';"

'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon


%>
<table width = "1000">
<table width = "800">
<tr>
<td>
Prioritization
</td>
</tr>
<tr>
<td><img src = "office1.jpg">
</td>

<td><img src = "office2.jpg">
</td>

<td><img src = "office3.jpg">
</td>

</tr>
</table>
<table border = "1">
<tr>
<th><font face="arial, helvetica" color="#000066" size="1"><b>Priority</b></font></th>
<th><font face="arial, helvetica" color="#000066" size="1"><b>TPR</b></font></th>
<th><font face="arial, helvetica" color="#000066" size="1"><b>Project Title</b></font></th>
<th><font face="arial, helvetica" color="#000066" size="1"><b>Business Contact</b></font></th>
<th><font face="arial, helvetica" color="#000066" size="1"><b>Status</b></font></th>
<th><font face="arial, helvetica" color="#000066" size="1"><b>Size</b></font></th>
<th><font face="arial, helvetica" color="#000066" size="1"><b>Department</b></font></th>
<th><font face="arial, helvetica" color="#000066" size="1"><b>C#</b></font></th>
</tr>
<%

'Loop through the recordset
Do While not rsGuestbook.EOF



'Write the HTML to display the current record in the recordset
Response.Write ("<br>")
tpr = rsGuestBook("TPR")
priority = rsGuestBook("Priority")
title = rsGuestBook("Project Title")
contact = rsGuestBook("Business Contact")
status = rsGuestBook("Status")
size = rsGuestBook("Size")
department = rsGuestBook("Department")
c# = rsGuestBook("C#")
%>
<tr>
<td>
</font><font face="arial, helvetica" color="#000066" size="1">
<%Response.Write ("<a href=""update_form_phones.asp?ID=" & rsGuestbook("ID_No") & """>")
Response.Write (rsGuestbook("Priority"))
Response.Write ("</a>") %>

</font>&nbsp;&nbsp;&nbsp;
</td>
<td>
</font><font face="arial, helvetica" color="#000066" size="1">
<%=tpr%></font>&nbsp;&nbsp;&nbsp;
</td>

<td>
</font><font face="arial, helvetica" color="#000066" size="1">
<%=title%></font>&nbsp;&nbsp;&nbsp;
</td>

<td>
</font><font face="arial, helvetica" color="#000066" size="1">
<%=contact%></font>&nbsp;&nbsp;&nbsp;
</td>

<td>
</font><font face="arial, helvetica" color="#000066" size="1">
<%=status%></font>&nbsp;&nbsp;&nbsp;
</td>

<td>
</font><font face="arial, helvetica" color="#000066" size="1">
<%=size%></font>&nbsp;&nbsp;&nbsp;
</td>

<td>
</font><font face="arial, helvetica" color="#000066" size="1">
<%=department%></font>&nbsp;&nbsp;&nbsp;
</td>

<td>
</font><font face="arial, helvetica" color="#000066" size="1">
<%=c#%></font>&nbsp;&nbsp;&nbsp;
</td>


</tr>

<% 'end if %>
<%
'Move to the next record in the recordset

rsGuestbook.MoveNext

Loop

'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
</table>
</table>
</body>
</html>
</code>

































































 
Beginning your loop, you output a <br /> element. That's a line break, however, you're outputting it between the table row close and table row open elements, where there should be no such element. Now you're left with a bunch of erroneous line breaks, more elements in the table, more line breaks. Since line breaks are not supposed to be there, many browsers will just shove them above the table. That is how you get all the blank lines. You can safely remove the line that prints that <br> at the beginning of the loop. It does nothing else but cause you problems.
 
Agreed.

Code:
 'Write the HTML to display the current record in the recordset
                       [red] Response.Write ("<br>")[/red]
                        tpr = rsGuestBook("TPR")
                        priority = rsGuestBook("Priority")

Remove the line break, and you should be o.k.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top