• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1497
  • Last Modified:

unable to place content place holder in table in an asp.net master page using vb.net 2005

Hi,

I am creating a master page in asp.net using vb.net 2005 studio. When the content place holder is outside the table there is no errors. coseL -

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" 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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left">&nbsp;</td>
    <td width="100%"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="70"><img src="images/logo.jpg" alt="654" width="350" height="120" /></td>
      </tr>
      <tr>
        <td background="images/bg9.gif" height="32">&nbsp;</td>
      </tr>
      <tr>
        <td background="images/f3.gif" height="33">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td background="images/bg1.gif" height="19">&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td><img src="images/head1.gif" alt="te4" width="193" height="37" /><br />
        <table width="193" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td background="images/bg8.gif" align="center"><table border="0" cellpadding="5" cellspacing="0" background="">
                <form>
                  <tr align="left">
                    <td width="151"><b>Login</b><br />                    </td>
                  </tr>
                  <tr align="left">
                    <td align="left"><b>Password</b><br />
                        <input type="image" src="images/b_sign.gif" align="left" width="79" height="25" border="0" />
                        <br /></td>
                  </tr>
                </form>
            </table></td>
          </tr>
        </table>
      <img src="images/tr2.gif" alt="645" width="193" height="7" /><br />
        <br />
        <img src="images/head4.gif" alt="6456" width="193" height="36" /><br />
        <table width="193" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td background="images/bg8.gif" align="center">&nbsp;</td>
          </tr>
        </table>
      <img src="images/tr2.gif" alt="645" width="193" height="7" /><br />
        <br />    </td>
    <td>&nbsp;</td>
    <td background="images/bg3.gif"><br /></td>
    <td width="100%"><div align="center">
      <div align="center"></div>
      </div></td>
    <td background="images/bg4.gif">&nbsp;</td>
    <td background="images/bg4.gif">&nbsp;</td>
    <td><img src="images/head3.gif" alt="ty54y4" width="193" height="37" /><br />
        <table width="193" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td background="images/bg6.gif"><table width="193" border="0" cellpadding="0" cellspacing="0" background="">
                <tr valign="top" align="left">
                  <td colspan="3"><br />
                      <br /></td>
                </tr>
            </table></td>
          </tr>
        </table>
      <img src="images/tr5.gif" alt="64" width="193" height="14" /><br />
        <br />    </td>
  </tr>
</table>
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
        </asp:contentplaceholder>
    </div>
    </form>
</body>
</html>



'*************************************************************************************************************

When I place it into a table cell it comes up with multiple errors saying: -

Error      1      Cannot switch views: This end tag has no matching start tag.      C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\WebSites\befilesmart.com\MasterPage.master      70      13      C:\...\befilesmart.com\

Error      6      Validation (XHTML 1.0 Transitional): Attribute 'background' is not a valid attribute of element 'td'.      C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\WebSites\befilesmart.com\MasterPage.master      20      13      C:\...\befilesmart.com\

Error      24      Validation (XHTML 1.0 Transitional): Attribute 'border' is not a valid attribute of element 'input'.      C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\WebSites\befilesmart.com\MasterPage.master      45      105      C:\...\befilesmart.com\

There are many more but these are a few. The code I am using that produces the errors are: -

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" 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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left">&nbsp;</td>
    <td width="100%"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="70"><img src="images/logo.jpg" alt="654" width="350" height="120" /></td>
      </tr>
      <tr>
        <td background="images/bg9.gif" height="32">&nbsp;</td>
      </tr>
      <tr>
        <td background="images/f3.gif" height="33">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td background="images/bg1.gif" height="19">&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td><img src="images/head1.gif" alt="te4" width="193" height="37" /><br />
        <table width="193" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td background="images/bg8.gif" align="center"><table border="0" cellpadding="5" cellspacing="0" background="">
                <form>
                  <tr align="left">
                    <td width="151"><b>Login</b><br />                    </td>
                  </tr>
                  <tr align="left">
                    <td align="left"><b>Password</b><br />
                        <input type="image" src="images/b_sign.gif" align="left" width="79" height="25" border="0" />
                        <br /></td>
                  </tr>
                </form>
            </table></td>
          </tr>
        </table>
      <img src="images/tr2.gif" alt="645" width="193" height="7" /><br />
        <br />
        <img src="images/head4.gif" alt="6456" width="193" height="36" /><br />
        <table width="193" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td background="images/bg8.gif" align="center">&nbsp;</td>
          </tr>
        </table>
      <img src="images/tr2.gif" alt="645" width="193" height="7" /><br />
        <br />    </td>
    <td>&nbsp;</td>
    <td background="images/bg3.gif"><br /></td>
    <td width="100%"><div align="center">
      <div align="center">
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
        </asp:contentplaceholder>
    </div>
    </div>
      </div></td>
    <td background="images/bg4.gif">&nbsp;</td>
    <td background="images/bg4.gif">&nbsp;</td>
    <td><img src="images/head3.gif" alt="ty54y4" width="193" height="37" /><br />
        <table width="193" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td background="images/bg6.gif"><table width="193" border="0" cellpadding="0" cellspacing="0" background="">
                <tr valign="top" align="left">
                  <td colspan="3"><br />
                      <br /></td>
                </tr>
            </table></td>
          </tr>
        </table>
      <img src="images/tr5.gif" alt="64" width="193" height="14" /><br />
        <br />    </td>
  </tr>
</table>
    </form>
</body>
</html>


What am I doing wrong please?

Many thanks
Lee

'*************************************************************************************************************

0
ljhodgett
Asked:
ljhodgett
1 Solution
 
ventaurCommented:
Hello.

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

Since you are using XHTML for your page, many style/format attributes are no longer acceptable (i.e., background, border, etc.). Check out this article on the differences between XHTML and HTML.

http://www.w3schools.com/xhtml/xhtml_html.asp


However, the first error relates to an extra end tag near your place holder. I've included the problem area below. Count the number of starting "div" tags, then count the number of ending "div" tags. There is one too many ending tags. Remove that last "</div>' tag and you'll be able to switch to design view just fine.
 <td width="100%"><div align="center">
      <div align="center">
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
        </asp:contentplaceholder>
    </div>
    </div>
      </div></td>

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now