Why is not the output from contentpage positioned on the same place

Hello!
I have a masterpage and eight content pages where each content page is using the master page. Each content page looks the same except that the output is a different string in each. The code behind file is empty in all files even the master page file. I use
navigation so I use the web.sitemap.

I list all files below starting with the master page file I also add the web.sitemap because I use navigation:
The problem I have when I run the application is that the output from each content page is not in the same location on the screen.
I found this very strange because the content page looks the same except the output string is different in each content page.
I hope someone can explain why the output from the content pages is not on the same position on the screen ?
I have used inline styling here just to make it easy for me when testing.

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Masterpage example</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>

<body style="background-color:#00FFFF">
    <form id="form1" runat="server">
       <div>
          <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />

          <table style="width:100%; background-color: #00FFFF;">
             <tr>
                <td>
                   <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" />
                </td>

                <td>
                   <asp:SiteMapPath ID="SiteMapPath1" runat="server"  />
                   <br />
                   <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
                   </asp:ContentPlaceHolder>
                   <br /><br /><br /><br />
                </td>
             </tr>
          </table>
          <br />
       </div>
    </form>
</body>
</html>

Here is all eight content pages
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Consulting.aspx.cs" Inherits="Consulting" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1 style="color: #FF0000;  font-size: xx-large; font-weight: bold">
      Consulting
   </h1>
</asp:Content>

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Hardware.aspx.cs" Inherits="Hardware" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <h1 style="color: #FF0000;  font-size: xx-large; font-weight: bold">
      Hardware
   </h1>
</asp:Content>

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <h1 style="color: #FF0000;  font-size: xx-large; font-weight: bold">
       Home
   </h1>
</asp:Content>

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Products.aspx.cs" Inherits="Products" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <h1 style="color: #FF0000;  font-size: xx-large; font-weight: bold">
      Products
   </h1>
</asp:Content>

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Services.aspx.cs" Inherits="Services" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <h1 style="color: #FF0000;  font-size: xx-large; font-weight: bold">
      Services
   </h1>
</asp:Content>

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Software.aspx.cs" Inherits="Software" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <h1 style="color: #FF0000;  font-size: xx-large; font-weight: bold">
      Software
   </h1>
</asp:Content>

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Support.aspx.cs" Inherits="Support" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <h1 style="color: #FF0000;  font-size: xx-large; font-weight: bold">
      Support
   </h1>
</asp:Content>

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Training.aspx.cs" Inherits="Training" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <h1 style="color: #FF0000;  font-size: xx-large; font-weight: bold">
      Training
   </h1>
</asp:Content>

Here is the web.sitemap xml file
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode title="Home" description="Home" url="~/Home.aspx">
        <siteMapNode title="Products" description="Our products" url="~/Products.aspx">
            <siteMapNode title="Hardware" description="Hardware choices" url="~/Hardware.aspx" />
            <siteMapNode title="Software" description="Software choices" url="~/Software.aspx" />
        </siteMapNode>
     
        <siteMapNode title="Services" description="Services we offer" url="~/Services.aspx">
            <siteMapNode title="Training" description="Training classes" url="~/Training.aspx" />
            <siteMapNode title="Consulting" description="Consulting services" url="~/Consulting.aspx" />
            <siteMapNode title="Support" description="Supports plans" url="~/Support.aspx" />
        </siteMapNode>
    </siteMapNode>
</siteMap>

//Tony

Give 40% or appropriate width to td as below

<table style="width:100%; background-color: #00FFFF;">
             <tr>
                <td width="40%">
                   <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" />
                </td>

Leave a Reply