How to place web user controls in the correct position?

Discussion in 'ASP .Net' started by Guest, Oct 31, 2005.

  1. Guest

    Guest Guest

    Hi, friends,

    This drove me nuts:

    I had two web user controls: header.ascx and copyright.ascx. I planed to put
    them on each .aspx pages: Header on the top, and Copyright at the bottom.

    However, I could NOT place them in the correct positions of the .aspx
    pages. The header.ascx, copyright.ascx, and contents of .aspx kept OVERLAP
    each other. For example, in the following .aspx, the two web user controls
    and .aspx table overlap together.

    <%@ Register TagPrefix="uc1" TagName="Copyright"
    Src="../Control/Copyright.ascx" %>
    <%@ Register TagPrefix="uc1" TagName="Header" Src="../Control/Header.ascx" %>
    <%@ Page language="c#" Codebehind="NewUser.aspx.cs" AutoEventWireup="false"
    Inherits="mesc4u.Management.NewUserGeneral" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>New User</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5"
    name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <uc1:Header id="Header1" runat="server"></uc1:Header>
    <TABLE id="Table1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute;
    TOP: 64px" cellSpacing="1"
    cellPadding="1" width="100%" border="1">
    <TR>
    <TD>asdfasd</TD>
    <TD></TD>
    <TD></TD>
    </TR>
    <TR>
    <TD style="HEIGHT: 27px">asdf</TD>
    <TD style="HEIGHT: 27px"></TD>
    <TD style="HEIGHT: 27px"></TD>
    </TR>
    <TR>
    <TD>asdf</TD>
    <TD></TD>
    <TD></TD>
    </TR>
    </TABLE>
    <uc1:Copyright id="Copyright1" runat="server"></uc1:Copyright>
    </body>
    </HTML>

    I believe that using user control to replace <include> was a good idea. But,
    if it did not work in asp.net, I would rather use other approaches.

    Any ideas, reference papers? Thanks a lot.
     
    Guest, Oct 31, 2005
    #1
    1. Advertisements

  2. Try it without grid layout and without absolute positioning.
    Tables and absolute positioning don't get along very well.
     
    Juan T. Llibre, Oct 31, 2005
    #2
    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.