Malformed HTML from UserControl

P

Patrick

Problem

I have an ASPX file, with a table of 3 columns, 2 rows with a usercontrol in
the middle column (in the code snippet stated below, although in reality,
the left hand column would also have a user control).

I have a "footer" on the second/bottom row. However, when the User Control
in the middle column, first row is generating a lot of text, the text is
"squashing" the text in the second role!

Don't believe me? Try it!

Using ASP.NET 1.1 on Windows XP Professional SP1 IIS5.1
Problem also replicable on ASP.NET 1.1 on Windows 2000 Server SP4 IIS5.0

---Start of WebForm1.aspx---
<%@ Register TagPrefix="uc1" TagName="SearchResults"
Src="UserControlDemo.ascx" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="HTMLProblem.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<link href="/Website/Styles/styles.css" type="text/css"
rel="stylesheet">
<meta content="Microsoft Visual Studio 7.0" 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">
<META http-equiv="Expires" content="0">
<META http-equiv="Pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache">
</HEAD>
<body>
<form id="SubPage" method="post" runat="server">
<table id="Table1" height="100%" cellSpacing="0" cellPadding="0"
width="100%" border="0">
<tr>
<TD vAlign="top" align="left" width="135"
bgColor="#000000">
<!-- Start Left Navigation -->
<table cellSpacing="0" cellPadding="0" width="100%"
border="0">
<%for (int j=0;j<15;j++)
{%>
<tr>
<td
class='NavSubChannelMainCell'>nav<%=j%></td>
</tr>
<%}%>
</table>
</TD>
<!-- End Left Navigation -->
<td vAlign="top" align="center" width="605"
style="WIDTH: 605px">
<TABLE id="Table2" height="100%" cellSpacing="0"
cellPadding="0" width="585" border="0">
<TR>
</TR>
<tr>
<td vAlign="top" align="center" width="555"
bgColor="#ffffff" height="1"><img alt="Breadcrumb trail"
src="/website/images/home/bread_crumb_dots.gif" border="0"></td>
</tr>
<TR>
</TR>
<TR>
<TD vAlign="top" align="left" width="565"
bgColor="#ffffff" height="100%">
<P>
<span class="bodytext">
<uc1:SearchResults
id="SearchResults1" runat="server"></uc1:SearchResults></span></P>
</TD>
</TR>
</TABLE>
</td>
<td vAlign='bottom' align='left' bgColor='#e71808'
style='HEIGHT: 495px'>
<IMG alt='Youth Justice Board Sub Page Text Bar'
src='/website/images/home/home_bar_text.gif'
border='0'>
</td>
</tr>
<!--<tr>
<td background="/website/images/home/footer_dots.gif"
colSpan="3" height="2"></td>
</tr>-->
<tr>
<td colSpan="3" height="15">
Footer Footer Footer</td>
</tr>
</table>
</form>
</body>
</HTML>
---End of WebForm1.aspx---
WebForm1.aspx.cs- leave as default

---start of UserControlDemo.ascx---
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="UserControlDemo.ascx.cs" Inherits="HTMLProblem.UserControlDemo"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<P>
<asp:label id="SearchResultsArea" CssClass="SearchResultsClass"
Visible="True" runat="server" Width="550px"></asp:label>
</p>
---end of UserControlDemo.ascx---

--Start of USerControlDemo.ascx.cs---
namespace HTMLProblem
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for UserControlDemo.
/// </summary>
public class UserControlDemo : System.Web.UI.UserControl
{
//protected System.Web.UI.WebControls.ImageButton SearchNext;
//protected System.Web.UI.WebControls.ImageButton SearchPrev;
protected System.Web.UI.WebControls.Label SearchResultsArea;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
DoSearch();
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DoSearch()
{
for (int i=0;i<100;i++)
{
SearchResultsArea.Text = SearchResultsArea.Text + "results
results results results results results <br>results results results results
results results results results results results results results results ";
}
}

}
}
--End of USerControlDemo.ascx.cs---
 
P

Patrick

Problem resolved!
This was caused by the use of absolute position in CSS Style sheet and not
ASP.NET
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top