Solved

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

Posted on 2007-11-17
1
1,468 Views
Last Modified: 2013-11-26
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
Comment
Question by:ljhodgett
1 Comment
 
LVL 6

Accepted Solution

by:
ventaur earned 500 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now