asp.NET MASTER PAGES QUESTION

Discussion in 'ASP .Net' started by Just Me, Jan 21, 2007.

  1. Just Me

    Just Me Guest

    Hi,

    I have build a header and footer control which I want to add to my master
    page, so in essence I want the header, a contact placeholder and a footer.

    This is something I used to do with vs2003 all the time and never had any
    problems.

    In vs2005 using master pages, I see the content placeholder is in a div tag.
    So I add another before and after to hold my controls.

    The problem is that the Content placeholder allways goes up the page and
    lies on top of my header control, event if I set the dive tags to relative
    position.

    What am I doing wrong ?
     
    Just Me, Jan 21, 2007
    #1
    1. Advertisements

  2. Just Me

    Mark Rae Guest

    It doesn't have to be... None of my MasterPages surrounds the content
    Sounds like you have placed the controls in your content page within a div
    with an absolute position...
    Impossible to tell unless you show us the code...
     
    Mark Rae, Jan 21, 2007
    #2
    1. Advertisements

  3. Just Me

    Just Me Guest

    OK Standbye for code.

     
    Just Me, Jan 21, 2007
    #3
  4. Just Me

    Just Me Guest

    Even if I only look at the master page, the content placeholder overlaps the
    generic header. If you need to see the header control let me know

    <%@ Master Language="VB" AutoEventWireup="false"
    CodeBehind="General.master.vb" Inherits="WATest.General" %>

    <%@ Register Src="controls/GenericHeader.ascx" TagName="GenericHeader"
    TagPrefix="uc1" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head runat="server">

    <title>Untitled Page</title>

    </head>

    <body>

    <form id="form1" runat="server">

    <div style="position:relative">

    <uc1:GenericHeader ID="GenericHeader1" runat="server" />

    </div>

    <div style="position:relative">


    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

    </asp:ContentPlaceHolder>

    </div>

    </form>

    </body>

    </html>
     
    Just Me, Jan 21, 2007
    #4
  5. Just Me

    Mark Rae Guest

    Firstly, there's no need to maintain your GenericHeader as a UserControl -
    that's the whole point of a MasterPage, but that shouldn't be causing your
    layout problems per se...

    The first thing I would try is to remove the GenericHeader control and
    replace it with some text. Then, remove the <div> tag from around your
    content placeholder and check that it does not overlap the text where the
    GenericHeader control used to be...
     
    Mark Rae, Jan 21, 2007
    #5
  6. Just Me

    Just Me Guest

    Hi Mark,

    Ive found the problem, the generic header elements were absolutely
    positioned, so I simply offset the div tag from normal flow by a said amount
    and that did the trick.

    I take your point about controls and master pages, but there may be several
    situations where I want to alter the master pages,and I dont want to have to
    re-create the menu and header graphics etc, so thats why I am taking this
    approach.

    Thank for your time.
     
    Just Me, Jan 21, 2007
    #6
  7. Just Me

    Mark Rae Guest

    Er, OK...
     
    Mark Rae, Jan 21, 2007
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.