For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > October 2005 > How to place web user controls in the correct position?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to place web user controls in the correct position?
Andrew

2005-10-30, 9:58 pm

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.

Juan T. Llibre

2005-10-31, 3:57 am

Try it without grid layout and without absolute positioning.
Tables and absolute positioning don't get along very well.




Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Espaņol : http://asp.net.do/foros/
======================================
"Andrew" <Andrew@discussions.microsoft.com> wrote in message
news:DC7133B6-E51B-4D7C-8CFC-A84CEE96184E@microsoft.com...
> 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.
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com