Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

HTML/CSS Page Headers

Posted on 2009-04-02
6
Medium Priority
?
407 Views
Last Modified: 2012-05-06
I am using vb code in .NET to write an HTML table. It works great except I need the "Company Name" is on the top of every page.   Right now the company name is at the beginning and the underlying table extends over multiple pages. I've tried Thead and it doesn't work. Is is VB? Is it IE?  I've attached the css file I'm using. THis is a test app so no commenting about bad technique. It works except for showing a header every page.

Thanks
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim _connectionString As String
        Dim sqlCmd As String
        Dim conn As New ADODB.Connection
       Dim rec As New ADODB.Recordset
 
        _connectionString = "Driver={SQL Server};Server=MYSERVER;Database=MYDBN;Trusted_Connection=yes;"
        
        sqlCmd = "SELECT  FormulaName, FormulaCode,Company  FROM Formula "
        conn.ConnectionString = _connectionString
        conn.Open()
        rec.Open(sqlCmd, conn, ADODB.CursorTypeEnum.adOpenStatic)
        Response.Write("<LINK REL='stylesheet' TYPE='text/css' media='print,screen'>")
        Response.Write("<H1 class='company' >" & rec(2).Value.ToString & "</H1><p>")
        Response.Write("<table class='contacts' cellspacing='0' summary='Contacts template'><tr>")
        Response.Write("<thead><tr><th>" & rec(2).Value.ToString & "</th></tr></thead>")
   
        Response.Write("<tbody>")
        While Not rec.EOF
            Response.Write("<tr><td class='contact' width='50%'>" & rec(0).Value.ToString & "</td>")
            Response.Write("<td class='contact' width='50%'>" & rec(1).Value.ToString & "</td>")
            Response.Write("<td class='contact' width='50%'>" & rec(2).Value.ToString & "</td>")
 
            Response.Write("</tr>")
 
 
 
            rec.MoveNext()
        End While
 
        Response.Write("</tbody></table>")
        rec.Close()
    End Sub

Open in new window

StyleSheet.txt
0
Comment
Question by:janmishkin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 5

Expert Comment

by:Rikus_Trent
ID: 24053619
What is your css style for the company header?

You can try giving it a fixed position. For print media, that should print as a running header, assuming the browser supports it.

Example:

h1{position:fixed; top:0;width:100%;}
0
 

Author Comment

by:janmishkin
ID: 24053770
I added your code
H1.company {position:fixed; top:0;width:100%;
Font-size:24px;
           color:blue;
           margin-top:-10px;
           margin-bottom:-15px;
      }
Still the company name is just at the start. Actually I thought the thead stuff was suppossed to give me page headers
see Response.Write("<thead><tr><th>" & rec(2).Value.ToString & "</th></tr></thead>")

rec(2) is the company name.
   

 
   
 
0
 
LVL 5

Expert Comment

by:Rikus_Trent
ID: 24054083
I can't say I've ever tried a running header outside of css styles.  Here's an attached html file with css styles applied for print media that gives a running header. It displays/prints great for me in FF3 and IE7.
example.txt
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:janmishkin
ID: 24054309
Tahts real close except

1 major problem is that in print preview on the second page the table starts at the very top of the page which overlaps the Header.
2. minor problem is that there is the same overlap when scrolling down.

Thanks so far its as close as I've come.
0
 

Author Comment

by:janmishkin
ID: 24061817
Is there a solution to the header problem? I need the page header to be seperate from the table(no overlap). Rikus Trents solution was very close but I can't use it unless there is seperation.
0
 

Accepted Solution

by:
janmishkin earned 0 total points
ID: 24062807
What would be a good reporting tool to use for having HTML level control over page headers and some kind of table or subreport grouped below. I just need to replicate CR or Access style reporting , specifically being able to have  dynamically generated formmatted text with images to appear on the page header.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question