Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Control displayed on top of page

Status
Not open for further replies.

Programmer2006

Programmer
Jun 29, 2006
12
US
I have a user control that I made for BreadCrumb Navigation. It works great but my problem is that it is on top of my whole page, above my headers. I tried placeing it on the bottom of the page but it shows up on the top anyway. Is there some way to get around this so that I can place my breadcrumb usercontrol below my headers?
 
Yes, it should be positioned with CSS. Have a read up on HTML and CSS are there are lots of methods you should know about before designing websites.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
In the usercontrol do you have the word style, position, or absolute located int the tags?

Babloome
 
NO i didn't but when i tried it I had the same problem. Below are the codes for Products.aspx and BreadCrumbs.ascx
BREADCRUMBS.ASCX

namespace WebApplication5
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Text;

/// <summary>
/// Summary description for BreadCrumb1.
/// </summary>
public abstract class BreadCrumb1 : System.Web.UI.UserControl
{

private void Page_Load(object sender, System.EventArgs e)
{//Product>Foamtreads

String strURL;
String strTrail;
String strReferURL;
String strTemp;
int intLen = 5;
strURL= this.Page.ToString();
if(strURL==("ASP.Products_aspx"))
{
strTrail = "Products";
}
else{


intLen = strURL.Length;
//Response.Write(intLen);
//intLen - _asp.aspx start index is 4
strURL = strURL.Substring(4,(intLen-9));
//Register this with all pages
//Response.Write("Page is "+ strURL);
//Response.Write("Parent is " + Request.UrlReferrer);
strReferURL = Request.UrlReferrer.ToString();
strReferURL = strReferURL.Replace('/','>');
strTrail = strReferURL + ">" +strURL;
string SearchString =("Products");
int FirstChar=strTrail.LastIndexOf(SearchString);
//Response.Write("\nPosition of product\n" + SearchString);
strTemp=strTrail.Remove(0, FirstChar);
int positionASPX = strTemp.IndexOf(".aspx");
//Response.Write(positionASPX);
strTemp = strTemp.Remove(positionASPX,5);
int dashPosition =strTemp.IndexOf("_");
if(dashPosition>-1){
strTemp=strTemp.Replace("_", " ");
}
strTrail = strTemp;
}
Response.Write(strTrail);


}

#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);
}

/// 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
}
}
--------------------------------------------------------
PRODUCTS.aspx
<%@ Page language="c#" Codebehind="Products.aspx.cs" AutoEventWireup="false" Inherits="WebApplication5.WebForm1" %>
<%@ Register TagPrefix="BreadCrumbUserControl" TagName="BreadCrumb" src="BreadCrumb.ascx"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Products</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content=" <link rel="stylesheet" type="text/css" href="../body.css">
<script type="text/javascript" src="../BreadCrumbs.js"></script>
<STYLE>.cell_over { BACKGROUND-COLOR: darkred }
.cell_over1 { BACKGROUND-COLOR: darkred }
</STYLE>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="115">
<tr>
<td width="285" style="WIDTH: 285px"><img src="images/./Banner2.gif" width="632" height="121" style="WIDTH: 632px; HEIGHT: 121px"></td>
<td width="13%"><img alt="Green Mountains Logo Picture Here" src="/GreenMountains.gif" style="WIDTH: 112px; HEIGHT: 54px" height="54" width="112"></td>
</tr>
</table>
<table border="1" cellpadding="0" cellspacing="0" style="BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; WIDTH: 744px; BORDER-COLLAPSE: collapse; HEIGHT: 19px" bordercolor="#111111" width="744" id="AutoNumber10" height="19">
<tr>
<td onMouseOver="this.className='cell_over';" onMouseOut="this.className='cell_out';" width="20%" bgcolor="forestgreen" bordercolor="#ffffff" style="BORDER-RIGHT: 1px solid; BORDER-TOP: medium none; BORDER-LEFT: 1px solid; BORDER-BOTTOM: medium none" align="middle" height="17">
<a href="nascHome.htm"><font size="1" color="#ffffff" face="Verdana"><b>Home</b></font></a></td>
<td onMouseOver="this.className='cell_over';" onMouseOut="this.className='cell_out';" width="20%" bgcolor="forestgreen" bordercolor="#ffffff" style="BORDER-RIGHT: 1px solid; BORDER-TOP: medium none; BORDER-LEFT: 1px solid; BORDER-BOTTOM: medium none" align="middle" height="17">
<a href="nascProducts.htm"><font size="1" color="#ffffff" face="Verdana"><b>Products</b></font></a></td>
<td onMouseOver="this.className='cell_over';" onMouseOut="this.className='cell_out';" width="20%" bgcolor="forestgreen" bordercolor="#ffffff" style="BORDER-RIGHT: 1px solid; BORDER-TOP: medium none; BORDER-LEFT: 1px solid; BORDER-BOTTOM: medium none" align="middle" height="17">
<a href="nascServices.htm"><font size="1" color="#ffffff" face="Verdana"><b>Services</b></font></a></td>
<td onMouseOver="this.className='cell_over';" onMouseOut="this.className='cell_out';" width="20%" bgcolor="forestgreen" bordercolor="#ffffff" style="BORDER-RIGHT: 1px solid; BORDER-TOP: medium none; BORDER-LEFT: 1px solid; BORDER-BOTTOM: medium none" align="middle" height="17">
<a href="nascContact.htm"><font size="1" color="#ffffff" face="Verdana"><b>Contact</b></font></a></td>
<td onMouseOver="this.className='cell_over';" onMouseOut="this.className='cell_out';" width="20%" bgcolor="forestgreen" bordercolor="#ffffff" style="BORDER-RIGHT: 1px solid; BORDER-TOP: medium none; BORDER-LEFT: 1px solid; BORDER-BOTTOM: medium none" align="middle" height="17">
<a href="nascAbout.htm"><font size="1" color="#ffffff" face="Verdana"><b>About Us</b></font></a></td>
</tr>
</table>
<P></P>
<p align="center"><b><font face="Verdana" size="1" color="#ffffff">
<breadcrumbusercontrol:BreadCrumb id="BreadCrumb1" runat="server"></breadcrumbusercontrol:BreadCrumb>
<TABLE id="Table1" style="WIDTH: 719px; HEIGHT: 160px" cellSpacing="0" cellPadding="0" width="719" border="0"> etc.....
 
Hi,

Your BreadCrumb control is after a table and before another one and inside an opening <p>
but you have not closed </p>

Put it inside either a new table or a new row within one of your other tables.

HTH

j

 
The main problems you are getting are due to the outdated techniques you are using. You should drop the use of tables for layout, get rid of the styling tags (such as <b> and <font>) and move all of the the inline attributes (such as border, height, width etc) into a CSS file.

Have a read up on styling pages with CSS before attempting the layout for this page.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I fixed it...I included a label in my usercontrol;
USERCONTROL:......breadcrumb.ascx the html........
<DIV id="pnlGrid" style="WIDTH: 20px; POSITION: relative; HEIGHT: 48px" runat="server"
ms_positioning="GridLayout"></DIV>
<asp:Label id="Label1" runat="server">Label</asp:Label><br>
.........................................................
added this to the ascx.cs
Label1.Text = strTrail
.................This allowed me to display the label anywhere on my aspx's instead of a Response.Write() which always shows up on the top of a page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top