Create Header & Footer for Master Page

Posted on 2007-10-08
Last Modified: 2008-01-09
I would like to add a header and footer to a Master Page (my first attempt).

What is the best way to do thgis? Add a DIV for each of Hedaer and Footer and name them accordingly?
Question by:allanmark
    LVL 16

    Expert Comment

    Assuming you need to overide the content of the Header and fotter, You would use Content Place Holders to alow you to overide the data.

    <asp:ContentPlaceHolder ID="cphHeader" runat="server" >Default Header Content<asp:ContentPlaceHolder/>

    With regards to how to structure the site you could use Tables, Divs or CSS layers whatever you are most comfortable with.

    Author Comment

    Thanks !!!!

    One last question .....

    How does once make sure that your footer is always at the bottom of the screen, if the page is "short" (ie only has a few lines?
    LVL 16

    Accepted Solution

    Now that is a more complicated question, The only way I've succedded to do this in the past is to use Tables and set the height. E.g.

    <table height="100%">
    <tr height="5%">
    <!-- Header Cell -->
    <tr height="90%">
    <!-- Body Cell -->
    <tr height="5%">
    <!-- Footer Cell -->

    Purists will tell you that this is bad and Web pages are designed to be as long as they need to be not full screen etc. you will also have problems with this approach if you have the Transitional DocType statment in your Master Page.

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now