OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

making table headers 'static' in asp

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> making table headers 'static' in asp
Page: [1]
 
 
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
making table headers 'static' in asp - 8/20/2003 20:07:11   
Does anyone know if there is a way to force <th> headers to remain in a 'static' position in an asp page, without having to use a Frames page. I am having trouble converting my single .asp page into Frames in FP2002, so that as the viewer scrolls though the data the headings reamin in the same place. I am looking to see if there is an asp solution now :)
thanks
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: making table headers 'static' in asp - 8/21/2003 10:29:12   
I know how to do it with IE 4+ but I don't think my method is very cross-browser friendly. If you're still interested, let me know....

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: making table headers 'static' in asp - 8/21/2003 12:10:47   
I use IE 6, so yes i am interested. I realized what was happening. In the <th> table protion i have tablewidth set to= 100% (this is the top frame of my frames page). In the .asp i have filling my lower frame i also have the data table set to width=-100%. While each column in the table headers has a value in it (the column heading), not every column in the data table has a value, so when i view it it squeezes all the data left....In ohter words tryin to make this work using Frames is a pain in the a@@.

Ig you know of a way to set the <th> so they stay on the screen in my asp page, that wouldbe great!!!!! then i dont have to use frames

(in reply to jaberwocky)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: making table headers 'static' in asp - 8/21/2003 13:40:01   
If you put all the repeating table code (not the header info) inside a <span> tag, you should be able to scroll the contents of the <span> and everything else stay the same. Kinda' like an inline frame except a little more restrictive. Maybe something like:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>RecordID</title>
</head>

<body>

<table width="450" border="1">
<tr>
<td width="30" ALIGN="LEFT"><b>ID</b></th>
<th width="150" ALIGN="LEFT"><b>Make</b></th>
<th width="150" ALIGN="LEFT"><b>Model</b></th>
<th width="120" ALIGN="LEFT"><b>Color</b></th>
</tr>
</table>

<span id="dataPanel" style="font:12pt;height:150px;width=480px;top:50;left:10;visibility:visible;overflow:scroll;background:#a0a0a0;position:absolute;border:3 inset black">

<!--#include file="_fpclass/fpdblib.inc"-->
<%
fp_sQry="SELECT * FROM Cars"
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=4 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="colorTest"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=4
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<table width="450" border="1">
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<tr>
<td width="30"><%=FP_FieldVal(fp_rs,"RecordID")%></td>
<td width="150"><%=FP_FieldVal(fp_rs,"Make")%></td>
<td width="150"><%=FP_FieldVal(fp_rs,"Model")%></td>
<td width="120"><%=FP_FieldVal(fp_rs,"Color")%></td>
</tr>
<!--#include file="_fpclass/fpdbrgn2.inc"-->
</table>

</span>

</body>
</html>

That was the complete page code I just made. It uses a dieted DRW from a simple test DB I use. The area of interest should be the parameters with the <span> tag. ALso, notice I used 2 tables; one for the headings outside the <span> and another for the contents inside the <span>. Replace my DB stuff with yours and play around with the span parameters to see what they do.

The only downfall to this method is in the absolute positioning; that's why its not very cross-browser freindly.

Hope it helps.

< Message edited by rdouglass -- 8/21/2003 1:41:26 PM >


_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to jaberwocky)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: making table headers 'static' in asp - 8/21/2003 15:37:30   
rdouglass, this is great. I have had a need for this for quite some time and since I am on an intranet where everyone uses IE, this works fantastic. One question, can a <span> be centered?

(in reply to jaberwocky)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: making table headers 'static' in asp - 8/21/2003 15:57:01   
quote:

can a <span> be centered?


I honestly don't know. I only use them with absolute positioning. I use them to build "tabbed" interfaces where I can hide and show spans on-the-fly without hitting the server.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: making table headers 'static' in asp - 8/21/2003 19:29:57   
it looks promising, but i am having difficulty positioning the data table. In my asp code i am only including the part you have bold <span> tag and the </span> after my </table> tag. I am not including all the fp_ xx lines you have. I also have 2 separate tables - 1 for my headers and one for my data. When i put in the "<span id="datapanel"............" it seems to just sit that 'panel' overtop my other data. I can see my table in behind it and it is only including one record within that panel. I think i am not sure where to position the first span tag.
here is a bit of my code. Keep in mind this is various sections of my code, but it gives an idea of what is going on:

... <th width="70" align="center"><font SIZE="2" FACE="Arial" COLOR="darkblue"><b>other</font></th>
<th WIDTH="150"align="center"><font SIZE="2" FACE="Arial" COLOR="darkblue"><b>Comments</font></th>

</tr>
</table>
<span id="dataPanel"
style="font:10pt;height:500px;width=1000px;top:140;left:5;visibility:visible;overflow:scroll;background:#ffffff;position:absolute;border:1
inset black">

<TBODY>
<%
Dim x, bgcolor
x=1

On Error Resume Next
rs.MoveFirst
Do While Not RS.EOF
%>
<%
stl=ucase(rs.fields("TL"))
'response.write stl
select case true

case ucase(rs.fields("TL"))="ACJCMH5"
stl="Craig"'
case ucase(rs.fields("TL"))="ACJCM43"
stl="Shelley"'
case else
stl="Not Available"

end select
%>

<div align="center">
<table WIDTH="1000" BORDER="0" BGCOLOR="" CELLSPACING="0">
<font FACE="Arial" COLOR="#000000">
<td <%if x = 1 then
bgcolor="lightgrey"
response.write "bgcolor='lightgrey'"
x=2
Else
bgcolor="White"
Response.write "bgcolor='white'"
x=1
End if%>

<tr>
<font width="80" SIZE="2" FACE="Arial"><%Response.Write stl%><br>r></font></td>
<td width="120" align="center" bgcolor='<%=bgcolor%>'><font SIZE="2"><%=Server.HTMLEncode(rs.Fields("dateofexception").Value)%><br>
</font></td>
<td width="80" align="center" bgcolor='<%=bgcolor%>'><font SIZE="2"><%=Server.HTMLEncode(rs.Fields("firstname").Value)%><br>
</font></td>

</tr>
</table>
</span>

<%
rs.MoveNext
loop%>


Sorry to send all this, but i wanted you to see how it interacts with all my other code. I cannot figure out where to put the initial <span> or if i do need all the "fp_ stuff you have in there.

thanks for any help.

(in reply to jaberwocky)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: making table headers 'static' in asp - 8/21/2003 19:52:57   
Your code is pure ASP so you do not need the FP stuff. As for the positioning, look at your previous post and in the code you put in red, find this snippet:

quote:

height:500px;width=1000px;top:140;left:5


The part that says top:140 code the table to appear 140 pixels from the top of the window. Change that value to move it higher or lower. The left variable moves your table from left to right. The height and width options will determine how big the box is.

Just a note, I played with this earlier today after reading this post. I had some success by deleting top:140;left:5 and the part that says position:absolute. When you do that, the two tables should line up.

Good luck.

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: making table headers 'static' in asp - 8/21/2003 19:59:58   
thanks. I did your suggestions but it still doesnt work. I expanded the top, left, etc and even deleted them, but the problem isnt the positions of the span 'pane', but the fact that my data doesnt go inside it - only the first record set from the table does. If i remove the left, top and absolute values, all my data shows up just below where the pane ends ( below the 500px height). My data just doesnt seem to be appearing within that pane.

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: making table headers 'static' in asp - 8/21/2003 20:09:51   
HA!!!! I figured it out. I had my </span> in the wrong place. I had to move it AFTER the <%
rs.MoveNext
loop%>

. I had it before this code, so it was only picking up my first record set.

Thanks! Looks much better :)
God i love this forum :)

(in reply to jaberwocky)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: making table headers 'static' in asp - 8/22/2003 8:59:33   
Just as an OT note, I only use <span> on IntraNets but use 'em frequently. Here's a screenshot of an application with a 'tabbed' interface. The data here is very static; doesn't change but a few times a month. So this page only hits the server once when they browse to it or when they manually refresh. Or, of course, when opening docs (that by the way, all open in new windows).

Yes, its a large page (over 1300 lines of code not including "includes" :)) but it actually acts like 7 full pages, each with it's own features, data, etc. The user has all their documentation they need accessable thru the whole day all from this 'one page'. Each 'tab' has 'onClick' events that hide/show the 'panels' and the tabs themselves are <span> so they can change color/style/etc. to indicate the active panel. Even the 'Jump To' items are in <span>.

Another nice 'feature' is the user experiences almost instant response when changing tabs.

Also, all my JavaScripts, etc. work normally inside the <span> as well. Notice my hierarchial folders that are JavaScript based.

In this circumstance, it is etremely efficient - 1 pageload per user per day; can't get much more efficient then that!

Again, the only downfall I've ever found to <span> is the cross browser issue so I don't use them at all wherever I'm not positive the user will be using IE 4+.

</$.02>

EDIT: Had to remove my UserName and Password info from the screenshot...:)


Thumbnail Image
:)

Attachment (1)

< Message edited by rdouglass -- 8/22/2003 9:03:25 AM >


_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to jaberwocky)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: making table headers 'static' in asp - 8/22/2003 16:24:33   
Very impressive rdouglass, as usual. I was also able to get mine to work almost perfectly. There do appear to be some issues with printing. I made two attempts to print, the first didn't print any info that was inside the <span>. The second printed only info. in the span and only if it was showing (anything that was hidden due to the position of the scrollbar did not print).

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: making table headers 'static' in asp - 8/22/2003 16:59:25   
yes, i found the same thing. When i printed, it would only print the information that was being viewed on the screen and not the entire contents of the span.

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: making table headers 'static' in asp - 8/22/2003 17:02:56   
one other point i want to ask. My data is set up so that the background rows alternate color - gray/white, but when i print the page the coored background doesnt print with it. It doesnt even show if i do print preview.I use

Dim x, bgcolor
x=1
and then
<td <%if x = 1 then
bgcolor="lightgrey"
response.write "bgcolor='lightgrey'"
x=2
Else
bgcolor="White"
Response.write "bgcolor='white'"
x=1
End if%>


Any thoughts on how to get my colored background to show in a printout?

(in reply to jaberwocky)
BeTheBall

 

Posts: 6502
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: making table headers 'static' in asp - 8/22/2003 21:08:18   
That is actually an option in your browser. Go to "Tools", "Internet Options", and the "Advanced Tab". Scroll down to Printing and you will see an option that says "Print background colors and images" That needs to be marked in order for your background stuff to print.

(in reply to jaberwocky)
lyners

 

Posts: 93
Joined: 7/25/2003
Status: offline

 
RE: making table headers 'static' in asp - 10/8/2003 11:18:12   
Rdouglas,
This works great, and appears to be what I need. I am having 2 problems with it , and I hope you (or somebody) could help.

I am retrieving data from a database and returning it to my screen, what I have done is added the header to the top, and then span the data. My results are almost perfect except:

1. I am getting a series of "h"'s in my span before I get to the data. Why? It does not show up in the ASP code.
2. My columns are not lining up with the header columns (nor are they the same width, even though I defined a width). Could this be because my data is bigger than the defined width?

I am looking for pointers on both points above. I am determined to have a scrollable area in my intranet site that users can scroll through the data and always see the column headings. That is my biggest complaint of my intranet site right now.

Thanks,
Lyners

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: making table headers 'static' in asp - 10/8/2003 12:47:14   
This table works great for me too, as far as lining up the table columns with the headers, I too struggled with that. I basically had to just fiddle with the column widths till i eventually got them lined up. I even tried just speicifing the table as 100% but that didint work.

As far as the 'h''s go, there but be something in your code that is spitting this out. I never had that problem.

(in reply to lyners)
clum1

 

Posts: 778
From: Glasgow, Scotland
Status: offline

 
RE: making table headers 'static' in asp - 10/8/2003 12:49:49   
I've only scanned this discussion, but surely what you guys are doing can be done easier like this:

Query the database
Create (open) the table (header row)
Open the database results, show first record
Loop through all records til end
Close the table.

?

That's certainly how I do it (it seems a lot simpler than spans etc.) and there's no browser worries as it simply fires out html code for a table.

e.g.

<%
'Display ALL companies in the database.
SQLQuery = "SELECT * FROM tblCompany ORDER BY strCoName"
SET RSFull = DBConnection.Execute(SQLQuery)
%>

<table border="1" cellspacing="3" id="AutoNumber1" cellpadding="2" bordercolor="#FFFFFF">
  <tr>
    <td class="HeaderCell">Company Name</td>
  </tr>
<% Do While not RSFull.Eof%>
  <tr>
    <td class="ContentCell">
        <%=RSFull("strCoName")%>
    </td>
  </tr>	
<%
    RSFull.Movenext
    Loop
    DBConnection.close
%>
    </table>


< Message edited by clum1 -- 10/8/2003 12:54:13 PM >


_____________________________

kenilweb.com; simple, effective web design

"So I said to the Gym instructor "Can you teach me to do the splits?" He said "How flexible are you?". I said "I can't make Tuesdays"."

Tim Vine

(in reply to lyners)
lyners

 

Posts: 93
Joined: 7/25/2003
Status: offline

 
RE: making table headers 'static' in asp - 10/8/2003 13:47:33   
clum1,
Yes that will create a table, but what we are trying to do is keep the column headings in front of you as you scroll down through the page. So we are using span to accomplish that. The one problem with span is trying to get your column headers to line up with your detail. So far, I have found it not to be an easy job. Hopefully somebody has done this before and can give me guidance. Right now my columns are adjusting themselves, even though I give it column widths! Thus my header doesn't line up with my detail. :)

Lyners

(in reply to clum1)
clum1

 

Posts: 778
From: Glasgow, Scotland
Status: offline

 
RE: making table headers 'static' in asp - 10/9/2003 2:14:48   
How about using ADO Paging to limit the results to 10-15 per page? It's tricky at first, but once mastered I found it invaluable.

clum

_____________________________

kenilweb.com; simple, effective web design

"So I said to the Gym instructor "Can you teach me to do the splits?" He said "How flexible are you?". I said "I can't make Tuesdays"."

Tim Vine

(in reply to lyners)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> making table headers 'static' in asp
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts