470,580 Members | 2,209 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,580 developers. It's quick & easy.

Malformed HTML from UserControl

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---
Nov 18 '05 #1
1 1365
Problem resolved!
This was caused by the use of absolute position in CSS Style sheet and not
ASP.NET
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by KC | last post: by
3 posts views Thread by Gérard Talbot | last post: by
6 posts views Thread by sviau | last post: by
5 posts views Thread by serge calderara | last post: by
1 post views Thread by Aaron Gray | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.